public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Muhammad Usama Anjum <musamaanjum@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, colin.king@canonical.com
Subject: Re: [PATCH] ALSA: usb-audio: Fix missing return assignment
Date: Thu, 25 Mar 2021 10:07:51 +0300	[thread overview]
Message-ID: <20210325070751.GU1667@kadam> (raw)
In-Reply-To: <abc46d0ad37b9e59ac71288d04e43c9911f71072.camel@gmail.com>

On Thu, Mar 25, 2021 at 01:24:23AM +0500, Muhammad Usama Anjum wrote:
> On Wed, 2021-03-24 at 21:50 +0300, Dan Carpenter wrote:
> > > -			usb_driver_claim_interface(driver, iface, (void *)-1L);
> > > +			err = usb_driver_claim_interface(driver, iface, (void *)-1L);
> > 
> > This is in a loop so only the last return value is used.  Which seems
> > sort of weird and pointless that the last value would matter more than
> > the others.
> > 
> Correct. Lets not store the return value. To stop the static analyzers
> to report the missing return assignment, can we add (void) in start of
> this function call? I've not seen use of (void) this way in the
> kernel. Is there any other way used in the kernel?

Don't add (void).  Don't add any code just to help static checkers, only
do it if it helps humans.  The (void) stuff is ugly.  We have a
__must_check annotation for functions where it's a bug not to check the
return and the usb_driver_claim_interface() is not a __must_check
function.  Just ignore the static checker when it's wrong.

When I'm reviewing static checker warnings, I only look at the new ones.
Then after I've looked at them, I mark them as old.  I currently have
65k old ignored warnings.

regards,
dan carpenter


      reply	other threads:[~2021-03-25  7:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 17:26 [PATCH] ALSA: usb-audio: Fix missing return assignment Muhammad Usama Anjum
2021-03-24 18:50 ` Dan Carpenter
2021-03-24 20:24   ` Muhammad Usama Anjum
2021-03-25  7:07     ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210325070751.GU1667@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=musamaanjum@gmail.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox