linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Anda-Maria Nicolae <anda-maria.nicolae@intel.com>
Cc: sre@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return
Date: Thu, 05 Mar 2015 08:13:17 -0800	[thread overview]
Message-ID: <1425571997.31859.4.camel@perches.com> (raw)
In-Reply-To: <1425554637-26782-2-git-send-email-anda-maria.nicolae@intel.com>

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;
>  	}

  reply	other threads:[~2015-03-05 16:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 11:23 [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers Anda-Maria Nicolae
2015-03-05 11:23 ` [PATCH 1/2] bq2415x_charger: Remove unnecessary else after return Anda-Maria Nicolae
2015-03-05 16:13   ` Joe Perches [this message]
2015-03-05 16:31     ` Nicolae, Anda-maria
2015-03-05 11:23 ` [PATCH 2/2] bq2415x_charger: Add support for bq24157s Anda-Maria Nicolae
2015-03-07 18:38 ` [PATCH 0/2] bq2415x_charger: Fix coding style issues and add new charger in the list of supported chargers Sebastian Reichel

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=1425571997.31859.4.camel@perches.com \
    --to=joe@perches.com \
    --cc=anda-maria.nicolae@intel.com \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.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 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).