[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <op.vsuq5nez3l0zgt@mnazarewicz-glaptop>
Date: Thu, 24 Mar 2011 15:42:50 +0100
From: "Michal Nazarewicz" <mina86@...a86.com>
To: "Greg Kroah-Hartman" <gregkh@...e.de>,
"Sergey Senozhatsky" <sergey.senozhatsky@...il.com>
Cc: "Alan Stern" <stern@...land.harvard.edu>,
"Chris Wright" <chrisw@...s-sol.org>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: check device_create_file() return code in
usb_create_sysfs_intf_files()
On Thu, 24 Mar 2011 15:31:16 +0100, Sergey Senozhatsky wrote:
> diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
> index 6781c36..5a02524 100644
> --- a/drivers/usb/core/sysfs.c
> +++ b/drivers/usb/core/sysfs.c
> @@ -856,8 +856,10 @@ int usb_create_sysfs_intf_files(struct
> usb_interface *intf)
> alt->string = usb_cache_string(udev, alt->desc.iInterface);
> if (alt->string)
> retval = device_create_file(&intf->dev, &dev_attr_interface);
> - intf->sysfs_files_created = 1;
> - return 0;
> + if (retval == 0)
> + intf->sysfs_files_created = 1;
> +
> + return retval;
> }
retval may be uninitialised. You need to zero it at the beginning of the
function (or somewhere).
> void usb_remove_sysfs_intf_files(struct usb_interface *intf)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +-----<email/xmpp: mnazarewicz@...gle.com>-----ooO--(_)--Ooo--
--
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