Re: [PATCH experimental 4/6] usb: cdc-wdm: adding interface => wdm_device list lookup

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

 



Oliver Neukum <oliver@xxxxxxxxxx> writes:

> Am Dienstag, 24. Januar 2012, 00:52:02 schrieb Bjørn Mork:
>> @@ -816,7 +855,9 @@ static void wdm_destroy(struct wdm_device *desc)
>>  static void wdm_disconnect(struct usb_interface *intf)
>>  {
>>         struct wdm_device *desc = wdm_get_device(intf);
>> -       wdm_destroy(desc);
>> +
>> +       if (desc)
>> +               wdm_destroy(desc);
>>  }
>>  
>>  #ifdef CONFIG_PM
>> @@ -825,6 +866,9 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
>>         struct wdm_device *desc = wdm_get_device(intf);
>>         int rv = 0;
>>  
>> +       if (!desc)
>> +               goto out;
>> +
>>         dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor);
>>  
>>         /* if this is an autosuspend the caller does the locking */
>> @@ -852,6 +896,7 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
>>                 mutex_unlock(&desc->rlock);
>>         }
>>  
>> +out:
>>         return rv;
>>  }
>
> Upon a closer look, this is a problem. We simply cannot ignore a disconnect() or suspend().
> So a code path for doing nothing here must be wrong.

Yes, this should be BUG_ON if anything.  But I believe it should really
just be removed.  It is the sort of thing I tend to add while hacking to
avoid ooopsing more than stricly necessary ;-) And which should go away
once the code is in proper shape.

Will remove.


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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux