lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 5 Mar 2015 16:31:10 +0000
From:	"Nicolae, Anda-maria" <anda-maria.nicolae@...el.com>
To:	Joe Perches <joe@...ches.com>
CC:	"sre@...nel.org" <sre@...nel.org>,
	"dbaryshkov@...il.com" <dbaryshkov@...il.com>,
	"dwmw2@...radead.org" <dwmw2@...radead.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/2] bq2415x_charger: Remove unnecessary else after
 return

Thanks for feedback :).

You are right, checkpatch.pl does not complain about issues in existing code. 
I did these changes so that existing code has similar coding style with the newly added code. 
This way, in the entire driver we will have the same coding style.

Regards,
Anda

________________________________________
From: Joe Perches [joe@...ches.com]
Sent: Thursday, March 05, 2015 6:13 PM
To: Nicolae, Anda-maria
Cc: sre@...nel.org; dbaryshkov@...il.com; dwmw2@...radead.org; linux-pm@...r.kernel.org; linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return

On Thu, 2015-03-05 at 13:23 +0200, Anda-Maria Nicolae wrote:
> Fix coding style to comply with checkpatch.pl

I think these are unnecessary changes.

The current version of checkpatch should not emit
a warning for the original code.

> diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
[]
> @@ -352,8 +352,7 @@ static int bq2415x_exec_command(struct bq2415x_device *bq,
>                       BQ2415X_BIT_CE);
>               if (ret < 0)
>                       return ret;
> -             else
> -                     return ret > 0 ? 0 : 1;
> +             return ret > 0 ? 0 : 1;

maybe return !ret

>       case BQ2415X_CHARGER_ENABLE:
>               return bq2415x_i2c_write_bit(bq, BQ2415X_REG_CONTROL,
>                               0, BQ2415X_BIT_CE);
> @@ -426,20 +425,17 @@ static enum bq2415x_chip bq2415x_detect_chip(struct bq2415x_device *bq)
>               case 0:
>                       if (bq->chip == BQ24151A)
>                               return bq->chip;
> -                     else
> -                             return BQ24151;
> +                     return BQ24151;
>               case 1:
>                       if (bq->chip == BQ24150A ||
>                               bq->chip == BQ24152 ||
>                               bq->chip == BQ24155)
>                               return bq->chip;
> -                     else
> -                             return BQ24150;
> +                     return BQ24150;
>               case 2:
>                       if (bq->chip == BQ24153A)
>                               return bq->chip;
> -                     else
> -                             return BQ24153;
> +                     return BQ24153;
>               default:
>                       return BQUNKNOWN;
>               }
> @@ -450,8 +446,7 @@ static enum bq2415x_chip bq2415x_detect_chip(struct bq2415x_device *bq)
>               case 0:
>                       if (bq->chip == BQ24156A)
>                               return bq->chip;
> -                     else
> -                             return BQ24156;
> +                     return BQ24156;
>               case 2:
>                       return BQ24158;
>               default:
> @@ -480,8 +475,7 @@ static int bq2415x_detect_revision(struct bq2415x_device *bq)
>       case BQ24152:
>               if (ret >= 0 && ret <= 3)
>                       return ret;
> -             else
> -                     return -1;
> +             return -1;
>       case BQ24153:
>       case BQ24153A:
>       case BQ24156:
> @@ -491,13 +485,11 @@ static int bq2415x_detect_revision(struct bq2415x_device *bq)
>                       return 0;
>               else if (ret == 1)
>                       return 1;
> -             else
> -                     return -1;
> +             return -1;
>       case BQ24155:
>               if (ret == 3)
>                       return 3;
> -             else
> -                     return -1;
> +             return -1;
>       case BQUNKNOWN:
>               return -1;
>       }



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ