lkml.org 
[lkml]   [2015]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb: ulpi: don't register drivers if bus doesn't exist
On 05/22/2015 06:16 AM, Heikki Krogerus wrote:
>>>>> diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
>>>>> > > >>index 0e6f968..0b0a5e7 100644
>>>>> > > >>--- a/drivers/usb/common/ulpi.c
>>>>> > > >>+++ b/drivers/usb/common/ulpi.c
>>>>> > > >>@@ -132,6 +132,10 @@ int ulpi_register_driver(struct ulpi_driver *drv)
>>>>> > > >> if (!drv->probe)
>>>>> > > >> return -EINVAL;
>>>>> > > >>+ /* Was the bus registered successfully? */
>>>>> > > >>+ if (!ulpi_bus.p)
>>>>> > > >>+ return -ENODEV;
>> >
>> > I think we need to warn in this case. How about:
>> >
>> > if (unlikely(WARN_ON(!ulpi_bus.p)))

No, please, the bus just doesn't exist - there's nothing wrong with that and there's
no reason to trigger an alarm for the user. Nothing out of the ordinary happened
here and the return value should be enough to tell the user what's up.

This will cause a perma-WARN for folks who have that bus built in but don't actually
have it on their system.

>> > return -ENODEV;
> I think we should also return -EAGAIN here.

EAGAIN? For when a bus doesn't exist? How would a user retrying fix the issue?


Thanks,
Sasha


\
 
 \ /
  Last update: 2015-05-22 16:41    [W:0.337 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site