[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1008031027250.1853-100000@iolanthe.rowland.org>
Date: Tue, 3 Aug 2010 10:29:52 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Valdis.Kletnieks@...edu
cc: "Justin P. Mattock" <justinmattock@...il.com>,
<linux-usb@...r.kernel.org>, <dbrownell@...rs.sourceforge.net>,
<gregkh@...e.de>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2]drivers/usb/core/sysfs.c Fix variable 'retval' set
but not used
On Tue, 3 Aug 2010 Valdis.Kletnieks@...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.
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists