Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1992056ybz; Sat, 18 Apr 2020 12:54:53 -0700 (PDT) X-Google-Smtp-Source: APiQypLdBfZuXSbGTcVU1uoq7c/2LCz6dzT2A88pVi2/rd2XduPmaLm9T0ds+zXh3nbLgc5BJWz1 X-Received: by 2002:a50:a642:: with SMTP id d60mr8231495edc.351.1587239693343; Sat, 18 Apr 2020 12:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587239693; cv=none; d=google.com; s=arc-20160816; b=PVVFnOE4mCRnxSJE/6FU6hCkeAIFc3wLUI1hVAZjdxsR3UAJ1fMK9ED1XYAH8eRrxd bYhhL0H6PNEPcwcuaqfQkAzGcpeiUUZAeQqZOxJ4BftMO+TY1tXcPNTUYv+gNzVh/psv qWScAakxyDdMuefTsrR4Di3zm2hZ1Wxr4zgSeVcioYs6omrfkpR6sOJM5TLqxxPV+KUb 9szl8uJ5aZR5Z3v7Fw61ybbJF6OCw5pLQHhWvV8Qs60EQo+9O+K+mi3IpM6YQ3w/Mko1 GaApZB1N/UeGgdEZ4+UVyyp0YUyCqFZqQjDmwZvG5TI9wjIOEqyjg5/f6pNeX9CB7GVW u5Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=5zQ04WU8Twq7HJwajbKV367K5H1WQe2flnmpcTkRyrw=; b=T7p5B3o+9jXCjLz2Ed3YmLfR2ItTKWabsrFmp+IyESJ1VQY6QX4OkV4kNyrkrTBf+4 v27tIfWLEUSFkLJj7YUC1M77HYzTXHsfcpMQf270Xvxfej6n4DC28lZgC2TETY8mYBDN /43Meg9uberDar62WB1dfy7Css4+L7PgbXz4+h3tl853fQ6oWS8mrS+4LnJ7M9ZSrhG/ KjqifRGgAt5uI7gwnEVyZuEIkbJXlocWwM+dJ1bC4VOOCbQPwO3HJ59cbMtQ4q36Qjjt kwAh0c8ucqJ5HJm8fm989o/45Q3pGVl8+950OuXSDG9ZoXbXi4p25I8wnVqda7KWJzl9 eyxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w19si11940151edx.386.2020.04.18.12.54.19; Sat, 18 Apr 2020 12:54:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728238AbgDRTyN (ORCPT + 99 others); Sat, 18 Apr 2020 15:54:13 -0400 Received: from netrider.rowland.org ([192.131.102.5]:43585 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728228AbgDRTyN (ORCPT ); Sat, 18 Apr 2020 15:54:13 -0400 Received: (qmail 9694 invoked by uid 500); 18 Apr 2020 15:54:12 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 18 Apr 2020 15:54:12 -0400 Date: Sat, 18 Apr 2020 15:54:12 -0400 (EDT) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Matthew Wilcox cc: Randy Dunlap , , Linus Torvalds , Andrew Morton , Alexander Viro , , Dmitry Torokhov , , Jaroslav Kysela , Takashi Iwai , , Greg Kroah-Hartman , , "J. Bruce Fields" , Chuck Lever , , Johannes Berg , Dan Williams , Vishal Verma , Dave Jiang , , "Martin K. Petersen" , , , Zzy Wysm Subject: Re: [PATCH 5/9] usb: fix empty-body warning in sysfs.c In-Reply-To: <20200418184409.GP5820@bombadil.infradead.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Sat, 18 Apr 2020, Matthew Wilcox wrote: > On Sat, Apr 18, 2020 at 11:41:07AM -0700, Randy Dunlap wrote: > > +++ linux-next-20200327/drivers/usb/core/sysfs.c > > @@ -1263,7 +1263,7 @@ 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. */ > > + do_empty(); /* We don't actually care if the function fails. */ > > intf->sysfs_files_created = 1; > > } > > Why not just? > > + if (alt->string) > + device_create_file(&intf->dev, &dev_attr_interface); This is another __must_check function call. The reason we don't care if the call fails is because the file being created holds the USB interface string descriptor, something which is purely informational and hardly ever gets set (and no doubt gets used even less often). Is this another situation where the comment should be expanded and the code modified to include a useless test and cast-to-void? Or should device_create_file() not be __must_check after all? Greg? Alan Stern