Re: [PATCH] musb: Add workqueue for URB giveback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Freitag, 26. Februar 2010 11:39:06 schrieb Ajay Kumar Gupta:
> +struct queue *create(void)
> +{
> +       struct queue *new;
> +       new = kmalloc(sizeof(struct queue), GFP_ATOMIC);
> +       if (!new)
> +               return NULL;
> +       new->next = NULL;
> +       return new;
> +}
> +void push_queue(struct musb *musb, struct urb *urb)
> +{
> +       struct queue *new, *temp;
> +
> +       new = create();
> +       new->urb = urb;

And you happily follow the NULL pointer in the error case.

> +
> +       temp = musb->qhead;
> +
> +       spin_lock(&musb->qlock);
> +       while (temp->next != NULL)
> +               temp = temp->next;
> +       temp->next = new;
> +       spin_unlock(&musb->qlock);
> +}

A design allocating memory in giveback is problematic. At least you need
to handle a failure to allocate memory. But you'd better handle this by putting
the list into the private part of the URB.

	Regards
		Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux