usb.c complete function : why no crash?

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

 



Hi,
using linux 2.4.27.
In arch/drivers/usb.c,usb_internal_control_msg() create one control urb with completion function as usb_api_blocking_completion() and context to be 0.


From the include/linux/usb.h,
struct urb
{
spinlock_t lock;        // lock for the URB
<snip>
void *context;          // context for completion routine
usb_complete_t complete;    // pointer to completion routine
//
}

I assume that upon completion, funtion pointer complete will be called with parameter context.
i.e, usb_api_blocking_completion(0) will be called.


but,
usb.c : usb_api_blocking_completion(struct urb *urb) {
struct usb_api_data *awd = (struct usb_api_data *)urb->context;

awd->done = 1;
wmb();
wake_up(&awd->wqh);
}
If the value of urb is NULL, this function will crash. But this does not happen.
Am I missing something?


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux