All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
@ 2020-10-06 17:06 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2020-10-06 17:06 UTC (permalink / raw)
  To: Sebastian Reichel, Dan Murphy, linux-pm; +Cc: kernel-janitors, linux-kernel

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;
 
-	if (ret)
-		return ret;
-
 	switch (psp) {
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
 		ret = bq25980_set_const_charge_curr(bq, val->intval);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
@ 2020-10-06 17:06 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2020-10-06 17:06 UTC (permalink / raw)
  To: Sebastian Reichel, Dan Murphy, linux-pm; +Cc: kernel-janitors, linux-kernel

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;
 
-	if (ret)
-		return ret;
-
 	switch (psp) {
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
 		ret = bq25980_set_const_charge_curr(bq, val->intval);
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
  2020-10-06 17:06 ` Colin King
@ 2020-10-06 17:23   ` Dan Murphy
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Murphy @ 2020-10-06 17:23 UTC (permalink / raw)
  To: Colin King, Sebastian Reichel, linux-pm; +Cc: kernel-janitors, linux-kernel

Colin

On 10/6/20 12:06 PM, 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;
>   
> -	if (ret)
> -		return ret;
> -
>   	switch (psp) {
>   	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
>   		ret = bq25980_set_const_charge_curr(bq, val->intval);

Thanks for the patch

Acked-by: Dan Murphy <dmurphy@ti.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
@ 2020-10-06 17:23   ` Dan Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Murphy @ 2020-10-06 17:23 UTC (permalink / raw)
  To: Colin King, Sebastian Reichel, linux-pm; +Cc: kernel-janitors, linux-kernel

Colin

On 10/6/20 12:06 PM, 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;
>   
> -	if (ret)
> -		return ret;
> -
>   	switch (psp) {
>   	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
>   		ret = bq25980_set_const_charge_curr(bq, val->intval);

Thanks for the patch

Acked-by: Dan Murphy <dmurphy@ti.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
  2020-10-06 17:06 ` Colin King
@ 2020-10-06 17:52   ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-10-06 17:52 UTC (permalink / raw)
  To: Colin King
  Cc: Sebastian Reichel, Dan Murphy, linux-pm, kernel-janitors, linux-kernel

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
@ 2020-10-06 17:52   ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-10-06 17:52 UTC (permalink / raw)
  To: Colin King
  Cc: Sebastian Reichel, Dan Murphy, linux-pm, kernel-janitors, linux-kernel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
  2020-10-06 17:23   ` Dan Murphy
@ 2020-10-08 21:35     ` Sebastian Reichel
  -1 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2020-10-08 21:35 UTC (permalink / raw)
  To: Dan Murphy; +Cc: Colin King, linux-pm, kernel-janitors, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1350 bytes --]

Hi,

On Tue, Oct 06, 2020 at 12:23:06PM -0500, Dan Murphy wrote:
> Colin
> 
> On 10/6/20 12:06 PM, 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;
> > -	if (ret)
> > -		return ret;
> > -
> >   	switch (psp) {
> >   	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
> >   		ret = bq25980_set_const_charge_curr(bq, val->intval);
> 
> Thanks for the patch
> 
> Acked-by: Dan Murphy <dmurphy@ti.com>

Thanks, queued.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
@ 2020-10-08 21:35     ` Sebastian Reichel
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2020-10-08 21:35 UTC (permalink / raw)
  To: Dan Murphy; +Cc: Colin King, linux-pm, kernel-janitors, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1350 bytes --]

Hi,

On Tue, Oct 06, 2020 at 12:23:06PM -0500, Dan Murphy wrote:
> Colin
> 
> On 10/6/20 12:06 PM, 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;
> > -	if (ret)
> > -		return ret;
> > -
> >   	switch (psp) {
> >   	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
> >   		ret = bq25980_set_const_charge_curr(bq, val->intval);
> 
> Thanks for the patch
> 
> Acked-by: Dan Murphy <dmurphy@ti.com>

Thanks, queued.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-08 21:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-10-06 17:52   ` Dan Carpenter

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.