The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin Ian King <colin.i.king@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: dvbdev: remove redundant initialization of variable ret
Date: Mon, 25 Apr 2022 14:57:43 +0300	[thread overview]
Message-ID: <20220425115743.GN2462@kadam> (raw)
In-Reply-To: <20220424154720.1356873-1-colin.i.king@gmail.com>

On Sun, Apr 24, 2022 at 04:47:20PM +0100, Colin Ian King wrote:
> Variable ret is being ininitialized with a value that is never read.
> The ininitializtion is redundant and can be removed. Move the variable
> to the scope it is required.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/media/dvb-core/dvbdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
> index 675d877a67b2..d5a142ef9876 100644
> --- a/drivers/media/dvb-core/dvbdev.c
> +++ b/drivers/media/dvb-core/dvbdev.c
> @@ -243,7 +243,7 @@ static void dvb_media_device_free(struct dvb_device *dvbdev)
>  static int dvb_create_tsout_entity(struct dvb_device *dvbdev,
>  				    const char *name, int npads)
>  {
> -	int i, ret = 0;
> +	int i;

It's better when "ret" has function scope.  Otherwise in the future
when someone adds a "ret" you're going to end up with two "ret"
variables.

regards,
dan carpenter


      reply	other threads:[~2022-04-25 11:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24 15:47 [PATCH] media: dvbdev: remove redundant initialization of variable ret Colin Ian King
2022-04-25 11:57 ` 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=20220425115743.GN2462@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=colin.i.king@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /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