All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Sebastian Reichel <sre@kernel.org>, Dan Murphy <dmurphy@ti.com>,
	linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
Date: Tue, 06 Oct 2020 17:52:38 +0000	[thread overview]
Message-ID: <20201006175238.GG4282@kadam> (raw)
In-Reply-To: <20201006170600.545361-1-colin.king@canonical.com>

On Tue, Oct 06, 2020 at 06:06:00PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently ret is assigned to zero and the following statement checks
> if it is non-zero. This check is redundant and can be removed
> 
> Addresses-Coverity: ("Logically dead code")
> Fixes: 5069185fc18e ("power: supply: bq25980: Add support for the BQ259xx family")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/power/supply/bq25980_charger.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/power/supply/bq25980_charger.c b/drivers/power/supply/bq25980_charger.c
> index 3995fb7cf060..f04f9acdb13b 100644
> --- a/drivers/power/supply/bq25980_charger.c
> +++ b/drivers/power/supply/bq25980_charger.c
> @@ -613,9 +613,6 @@ static int bq25980_set_battery_property(struct power_supply *psy,
>  	struct bq25980_device *bq = power_supply_get_drvdata(psy);
>  	int ret = 0;

I'm surprised this doesn't generate a set but not used warning.  And
then at the end of the function it could be changed from "return ret;"
to "return 0;"

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Sebastian Reichel <sre@kernel.org>, Dan Murphy <dmurphy@ti.com>,
	linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
Date: Tue, 6 Oct 2020 20:52:38 +0300	[thread overview]
Message-ID: <20201006175238.GG4282@kadam> (raw)
In-Reply-To: <20201006170600.545361-1-colin.king@canonical.com>

On Tue, Oct 06, 2020 at 06:06:00PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently ret is assigned to zero and the following statement checks
> if it is non-zero. This check is redundant and can be removed
> 
> Addresses-Coverity: ("Logically dead code")
> Fixes: 5069185fc18e ("power: supply: bq25980: Add support for the BQ259xx family")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/power/supply/bq25980_charger.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/power/supply/bq25980_charger.c b/drivers/power/supply/bq25980_charger.c
> index 3995fb7cf060..f04f9acdb13b 100644
> --- a/drivers/power/supply/bq25980_charger.c
> +++ b/drivers/power/supply/bq25980_charger.c
> @@ -613,9 +613,6 @@ static int bq25980_set_battery_property(struct power_supply *psy,
>  	struct bq25980_device *bq = power_supply_get_drvdata(psy);
>  	int ret = 0;

I'm surprised this doesn't generate a set but not used warning.  And
then at the end of the function it could be changed from "return ret;"
to "return 0;"

regards,
dan carpenter


  parent reply	other threads:[~2020-10-06 17:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 17:06 [PATCH][next] power: supply: bq25980: remove redundant zero check on ret Colin King
2020-10-06 17:06 ` Colin King
2020-10-06 17:23 ` Dan Murphy
2020-10-06 17:23   ` Dan Murphy
2020-10-08 21:35   ` Sebastian Reichel
2020-10-08 21:35     ` Sebastian Reichel
2020-10-06 17:52 ` Dan Carpenter [this message]
2020-10-06 17:52   ` Dan Carpenter

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=20201006175238.GG4282@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=colin.king@canonical.com \
    --cc=dmurphy@ti.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.