Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Cc: alsa-devel@alsa-project.org,
	Sanyog Kale <sanyog.r.kale@intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: Re: [PATCH] soundwire: (cosmetic) remove multiple superfluous "else" statements
Date: Sat, 2 May 2020 17:29:34 +0530	[thread overview]
Message-ID: <20200502115934.GS948789@vkoul-mobl.Dlink> (raw)
In-Reply-To: <20200422151136.GA9425@ubuntu>

Hi Guennadi,

On 22-04-20, 17:11, Guennadi Liakhovetski wrote:
> No need for an "else" after a "return" statement. Remove multiple such
> occurrences.

lgtm, can you please split the patches, one for core sdw (bus.c) and one
for intel parts please

Thanks

> 
> Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
> ---
>  drivers/soundwire/bus.c            | 17 ++++++++++-------
>  drivers/soundwire/cadence_master.c |  8 ++++++--
>  drivers/soundwire/intel_init.c     |  4 +++-
>  3 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> index 488c3c9..32de017 100644
> --- a/drivers/soundwire/bus.c
> +++ b/drivers/soundwire/bus.c
> @@ -284,9 +284,10 @@ int sdw_fill_msg(struct sdw_msg *msg, struct sdw_slave *slave,
>  	msg->flags = flags;
>  	msg->buf = buf;
>  
> -	if (addr < SDW_REG_NO_PAGE) { /* no paging area */
> +	if (addr < SDW_REG_NO_PAGE) /* no paging area */
>  		return 0;
> -	} else if (addr >= SDW_REG_MAX) { /* illegal addr */
> +
> +	if (addr >= SDW_REG_MAX) { /* illegal addr */
>  		pr_err("SDW: Invalid address %x passed\n", addr);
>  		return -EINVAL;
>  	}
> @@ -306,7 +307,9 @@ int sdw_fill_msg(struct sdw_msg *msg, struct sdw_slave *slave,
>  	if (!slave) {
>  		pr_err("SDW: No slave for paging addr\n");
>  		return -EINVAL;
> -	} else if (!slave->prop.paging_support) {
> +	}
> +
> +	if (!slave->prop.paging_support) {
>  		dev_err(&slave->dev,
>  			"address %x needs paging but no support\n", addr);
>  		return -EINVAL;
> @@ -375,8 +378,8 @@ static int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value)
>  	ret = sdw_transfer(bus, &msg);
>  	if (ret < 0)
>  		return ret;
> -	else
> -		return buf;
> +
> +	return buf;
>  }
>  
>  static int
> @@ -471,8 +474,8 @@ int sdw_read(struct sdw_slave *slave, u32 addr)
>  	ret = sdw_nread(slave, addr, 1, &buf);
>  	if (ret < 0)
>  		return ret;
> -	else
> -		return buf;
> +
> +	return buf;
>  }
>  EXPORT_SYMBOL(sdw_read);
>  
> diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
> index ecd357d1..9ea8753 100644
> --- a/drivers/soundwire/cadence_master.c
> +++ b/drivers/soundwire/cadence_master.c
> @@ -407,7 +407,9 @@ void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root)
>  	if (nack) {
>  		dev_err_ratelimited(cdns->dev, "Msg NACKed for Slave %d\n", msg->dev_num);
>  		return SDW_CMD_FAIL;
> -	} else if (no_ack) {
> +	}
> +
> +	if (no_ack) {
>  		dev_dbg_ratelimited(cdns->dev, "Msg ignored for Slave %d\n", msg->dev_num);
>  		return SDW_CMD_IGNORED;
>  	}
> @@ -520,7 +522,9 @@ void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root)
>  		dev_err_ratelimited(cdns->dev,
>  				    "SCP_addrpage NACKed for Slave %d\n", msg->dev_num);
>  		return SDW_CMD_FAIL;
> -	} else if (no_ack) {
> +	}
> +
> +	if (no_ack) {
>  		dev_dbg_ratelimited(cdns->dev,
>  				    "SCP_addrpage ignored for Slave %d\n", msg->dev_num);
>  		return SDW_CMD_IGNORED;
> diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
> index 4b76940..d5d4279 100644
> --- a/drivers/soundwire/intel_init.c
> +++ b/drivers/soundwire/intel_init.c
> @@ -86,7 +86,9 @@ static int sdw_intel_cleanup_pdev(struct sdw_intel_ctx *ctx)
>  		dev_err(&adev->dev, "Link count %d exceeds max %d\n",
>  			count, SDW_MAX_LINKS);
>  		return NULL;
> -	} else if (!count) {
> +	}
> +
> +	if (!count) {
>  		dev_warn(&adev->dev, "No SoundWire links detected\n");
>  		return NULL;
>  	}
> -- 
> 1.9.3

-- 
~Vinod

      reply	other threads:[~2020-05-02 12:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 15:11 [PATCH] soundwire: (cosmetic) remove multiple superfluous "else" statements Guennadi Liakhovetski
2020-05-02 11:59 ` Vinod Koul [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=20200502115934.GS948789@vkoul-mobl.Dlink \
    --to=vkoul@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=guennadi.liakhovetski@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sanyog.r.kale@intel.com \
    /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