lkml.org 
[lkml]   [2010]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2]drivers/usb/core/sysfs.c Fix variable 'retval' set but not used
On 08/03/2010 07:29 AM, Alan Stern wrote:
> On Tue, 3 Aug 2010 Valdis.Kletnieks@vt.edu wrote:
>
>> On Mon, 02 Aug 2010 21:26:28 PDT, "Justin P. Mattock" said:
>>> diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
>>
>>> if (alt->string)
>>> - retval = device_create_file(&intf->dev,&dev_attr_interface);
>>> + device_create_file(&intf->dev,&dev_attr_interface);
>>> intf->sysfs_files_created = 1;
>>> return 0;
>
> Justin, did you try compiling your new code? Those unused values are
> there because device_create_file is declared as __must_check.
>

I went as far as compiling, once I saw no warning then figured o.k
I'll send out what I have for feedback then go from there.
(and just for the record I want to thank those who took the time to go
through and give feedback).


>> What should the code do if device_create_file() manages to fail? Yes, ignoring
>> the return value is one option, but is it the best one? 'return ret;' might be
>> another one. Somebody who understands this code and has more caffeine than me
>> should look this over.
>
> Failure to create a file in sysfs is almost never fatal and usually not
> even dangerous. Ignoring the error is generally better than failing
> the entire operation.
>
> Alan Stern
>
>

ahh.. you made this more clear for me.. cool thanks!

Justin P. Mattock


\
 
 \ /
  Last update: 2010-08-03 16:45    [W:0.048 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site