On 21/08/2019 17:30, Alan Stern wrote:
> On Wed, 21 Aug 2019, Roger Quadros wrote:
>
>> If binding a pending gadget driver fails we should not
>> remove it from the pending driver list, otherwise it
>> will cause a segmentation fault later when the gadget driver is
>> unloaded.
>
>> Signed-off-by: Roger Quadros <rog...@ti.com>
>> ---
>> drivers/usb/gadget/udc/core.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
>> index 7cf34beb50df..c272c8014772 100644
>> --- a/drivers/usb/gadget/udc/core.c
>> +++ b/drivers/usb/gadget/udc/core.c
>> @@ -1142,7 +1142,7 @@ static int check_pending_gadget_drivers(struct usb_udc
>> *udc)
>> if (!driver->udc_name || strcmp(driver->udc_name,
>> dev_name(&udc->dev)) == 0) {
>> ret = udc_bind_to_driver(udc, driver);
>> - if (ret != -EPROBE_DEFER)
>> + if (!ret)
>> list_del(&driver->pending);
>> break;
>> }
>
> This is kind of a policy question. If binding a pending gadget driver
> fails, should the driver remain pending?
>
> Depending on the answer to this question, you might want to change the
> list_del to list_del_init. That should fix the segmentation fault
> just as well.
OK. I'll send a revised patch to retain existing policy.
cheers,
-roger
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki