From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB103C352BE for ; Sat, 18 Apr 2020 19:55:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 55B1721BE5 for ; Sat, 18 Apr 2020 19:55:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="BdJe6Lji" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55B1721BE5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AEBF915F2; Sat, 18 Apr 2020 21:54:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AEBF915F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587239710; bh=EbTltHLbmJDcfv+QgJ53Zs6Dh3n7WQQmDn6cdc3ouHg=; h=Date:From:To:Subject:In-Reply-To:Cc:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From; b=BdJe6LjiRDWz17UoqmwDBYzJUca/iaPc1r8DWliR4Yc1eKq9XZb5+FM/MJ0zi1Y8A DS1rifY6UWJXwzTTivfzB3ORAfAbliIX6/N1fpQiv00pJdN4QCeadz79p9jNO1x7PN TsmtyMqrWf2N/Mwm5BOvlpWTbKLPI+CPJjLY7+74= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3DA52F8013D; Sat, 18 Apr 2020 21:54:20 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0D56DF8014E; Sat, 18 Apr 2020 21:54:19 +0200 (CEST) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by alsa1.perex.cz (Postfix) with SMTP id 9CD8CF800E7 for ; Sat, 18 Apr 2020 21:54:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9CD8CF800E7 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 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 Cc: alsa-devel@alsa-project.org, Randy Dunlap , Zzy Wysm , linux-kernel@vger.kernel.org, "J. Bruce Fields" , target-devel@vger.kernel.org, Dave Jiang , linux-scsi@vger.kernel.org, linux-nvdimm@lists.01.org, Vishal Verma , Chuck Lever , linux-input@vger.kernel.org, Alexander Viro , Dan Williams , Andrew Morton , linux-nfs@vger.kernel.org, "Martin K. Petersen" , Greg Kroah-Hartman , Dmitry Torokhov , Takashi Iwai , linux-usb@vger.kernel.org, linux-fsdevel@vger.kernel.org, Johannes Berg , Linus Torvalds X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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