linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Nigel Christian <nigel.l.christian@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Remove unused variable
Date: Mon, 3 May 2021 13:07:29 +0300	[thread overview]
Message-ID: <YI/LYY4LGmGEGyo1@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20210503092924.GO1981@kadam>

On Mon, May 03, 2021 at 12:29:24PM +0300, Dan Carpenter wrote:
> On Fri, Apr 30, 2021 at 06:18:14PM -0400, Nigel Christian wrote:
> > The variable buflen is being assigned a value that is never read,
> > which can be removed.
> > 
> > Addresses-Coverity: ("Unused value")
> > Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
> > ---
> >  drivers/media/usb/uvc/uvc_driver.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > index 9a791d8ef200..370b086c6e22 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -768,7 +768,6 @@ static int uvc_parse_format(struct uvc_device *dev,
> >  		format->xfer_func = uvc_xfer_func(buffer[4]);
> >  		format->ycbcr_enc = uvc_ycbcr_enc(buffer[5]);
> >  
> > -		buflen -= buffer[0];
> >  		buffer += buffer[0];
> >  	}
> 
> This is a situation where I think that the unused assignment helps
> readability because it shows how buflen and buffer are connected.

And removing it may cause issues later if we end up adding more code
below (unlikely in practice though). I'd rather keep this line.

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2021-05-03 10:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30 22:18 [PATCH] media: uvcvideo: Remove unused variable Nigel Christian
2021-05-03  9:29 ` Dan Carpenter
2021-05-03 10:07   ` Laurent Pinchart [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=YI/LYY4LGmGEGyo1@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nigel.l.christian@gmail.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;
as well as URLs for NNTP newsgroup(s).