All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: core: Replace an empty statement with a debug message
@ 2020-04-22 20:20 Alan Stern
  0 siblings, 0 replies; only message in thread
From: Alan Stern @ 2020-04-22 20:20 UTC (permalink / raw)
  To: Greg KH; +Cc: NeilBrown, USB list

This patch adds a dev_dbg() message to usb_create_sysfs_intf_files().
The message is not expected ever to appear; it's real purpose is to
satisfy the __must_check attribute on device_create_file() without
triggering a compiler warning about an empty statement.

In fact we don't really care if the sysfs attribute file doesn't get
created.  The interface string descriptor is purely informational and
hardly ever present.

Suggested-by: NeilBrown <neilb@suse.de>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

---


[as1936]


 drivers/usb/core/sysfs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: usb-devel/drivers/usb/core/sysfs.c
===================================================================
--- usb-devel.orig/drivers/usb/core/sysfs.c
+++ usb-devel/drivers/usb/core/sysfs.c
@@ -1262,8 +1262,10 @@ void usb_create_sysfs_intf_files(struct
 
 	if (!alt->string && !(udev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS))
 		alt->string = usb_cache_string(udev, alt->desc.iInterface);
-	if (alt->string && device_create_file(&intf->dev, &dev_attr_interface))
-		;	/* We don't actually care if the function fails. */
+	if (alt->string && device_create_file(&intf->dev, &dev_attr_interface)) {
+		/* This is not a serious error */
+		dev_dbg(&intf->dev, "interface string descriptor file not created\n");
+	}
 	intf->sysfs_files_created = 1;
 }
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-22 20:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22 20:20 [PATCH] USB: core: Replace an empty statement with a debug message Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.