All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] devfreq/exynos-bus: Use common error handling code in exynos_bus_target()
Date: Mon, 23 Oct 2017 01:17:07 +0000	[thread overview]
Message-ID: <59ED4313.701@samsung.com> (raw)
In-Reply-To: <4a407cd6-020c-1750-019a-6c0ceb40e245@users.sourceforge.net>

Hi Markus,

As I already commented on your other patch related to extcon-max14577,
this patch might remove the redundant error message. But, it makes
the code more complicated in side of readability. I prefer existing code.

On 2017년 10월 22일 22:40, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 22 Oct 2017 15:33:06 +0200
> 
> Adjust jump targets so that a bit of exception handling can be better
> reused at the end of this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/devfreq/exynos-bus.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
> index 49f68929e024..e38d456b2d7d 100644
> --- a/drivers/devfreq/exynos-bus.c
> +++ b/drivers/devfreq/exynos-bus.c
> @@ -124,34 +124,33 @@ static int exynos_bus_target(struct device *dev, unsigned long *freq, u32 flags)
>  
>  	if (old_freq < new_freq) {
>  		ret = regulator_set_voltage_tol(bus->regulator, new_volt, tol);
> -		if (ret < 0) {
> -			dev_err(bus->dev, "failed to set voltage\n");
> -			goto out;
> -		}
> +		if (ret < 0)
> +			goto report_failure;
>  	}
>  
>  	ret = clk_set_rate(bus->clk, new_freq);
>  	if (ret < 0) {
>  		dev_err(dev, "failed to change clock of bus\n");
>  		clk_set_rate(bus->clk, old_freq);
> -		goto out;
> +		goto unlock;
>  	}
>  
>  	if (old_freq > new_freq) {
>  		ret = regulator_set_voltage_tol(bus->regulator, new_volt, tol);
> -		if (ret < 0) {
> -			dev_err(bus->dev, "failed to set voltage\n");
> -			goto out;
> -		}
> +		if (ret < 0)
> +			goto report_failure;
>  	}
>  	bus->curr_freq = new_freq;
>  
>  	dev_dbg(dev, "Set the frequency of bus (%luHz -> %luHz, %luHz)\n",
>  			old_freq, new_freq, clk_get_rate(bus->clk));
> -out:
> +unlock:
>  	mutex_unlock(&bus->lock);
> -
>  	return ret;
> +
> +report_failure:
> +	dev_err(bus->dev, "failed to set voltage\n");
> +	goto unlock;
>  }
>  
>  static int exynos_bus_get_dev_status(struct device *dev,
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

WARNING: multiple messages have this Message-ID (diff)
From: Chanwoo Choi <cw00.choi@samsung.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Kukjin Kim <kgene@kernel.org>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] devfreq/exynos-bus: Use common error handling code in exynos_bus_target()
Date: Mon, 23 Oct 2017 10:17:07 +0900	[thread overview]
Message-ID: <59ED4313.701@samsung.com> (raw)
In-Reply-To: <4a407cd6-020c-1750-019a-6c0ceb40e245@users.sourceforge.net>

Hi Markus,

As I already commented on your other patch related to extcon-max14577,
this patch might remove the redundant error message. But, it makes
the code more complicated in side of readability. I prefer existing code.

On 2017년 10월 22일 22:40, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 22 Oct 2017 15:33:06 +0200
> 
> Adjust jump targets so that a bit of exception handling can be better
> reused at the end of this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/devfreq/exynos-bus.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
> index 49f68929e024..e38d456b2d7d 100644
> --- a/drivers/devfreq/exynos-bus.c
> +++ b/drivers/devfreq/exynos-bus.c
> @@ -124,34 +124,33 @@ static int exynos_bus_target(struct device *dev, unsigned long *freq, u32 flags)
>  
>  	if (old_freq < new_freq) {
>  		ret = regulator_set_voltage_tol(bus->regulator, new_volt, tol);
> -		if (ret < 0) {
> -			dev_err(bus->dev, "failed to set voltage\n");
> -			goto out;
> -		}
> +		if (ret < 0)
> +			goto report_failure;
>  	}
>  
>  	ret = clk_set_rate(bus->clk, new_freq);
>  	if (ret < 0) {
>  		dev_err(dev, "failed to change clock of bus\n");
>  		clk_set_rate(bus->clk, old_freq);
> -		goto out;
> +		goto unlock;
>  	}
>  
>  	if (old_freq > new_freq) {
>  		ret = regulator_set_voltage_tol(bus->regulator, new_volt, tol);
> -		if (ret < 0) {
> -			dev_err(bus->dev, "failed to set voltage\n");
> -			goto out;
> -		}
> +		if (ret < 0)
> +			goto report_failure;
>  	}
>  	bus->curr_freq = new_freq;
>  
>  	dev_dbg(dev, "Set the frequency of bus (%luHz -> %luHz, %luHz)\n",
>  			old_freq, new_freq, clk_get_rate(bus->clk));
> -out:
> +unlock:
>  	mutex_unlock(&bus->lock);
> -
>  	return ret;
> +
> +report_failure:
> +	dev_err(bus->dev, "failed to set voltage\n");
> +	goto unlock;
>  }
>  
>  static int exynos_bus_get_dev_status(struct device *dev,
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

WARNING: multiple messages have this Message-ID (diff)
From: cw00.choi@samsung.com (Chanwoo Choi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] devfreq/exynos-bus: Use common error handling code in exynos_bus_target()
Date: Mon, 23 Oct 2017 10:17:07 +0900	[thread overview]
Message-ID: <59ED4313.701@samsung.com> (raw)
In-Reply-To: <4a407cd6-020c-1750-019a-6c0ceb40e245@users.sourceforge.net>

Hi Markus,

As I already commented on your other patch related to extcon-max14577,
this patch might remove the redundant error message. But, it makes
the code more complicated in side of readability. I prefer existing code.

On 2017? 10? 22? 22:40, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 22 Oct 2017 15:33:06 +0200
> 
> Adjust jump targets so that a bit of exception handling can be better
> reused at the end of this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/devfreq/exynos-bus.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
> index 49f68929e024..e38d456b2d7d 100644
> --- a/drivers/devfreq/exynos-bus.c
> +++ b/drivers/devfreq/exynos-bus.c
> @@ -124,34 +124,33 @@ static int exynos_bus_target(struct device *dev, unsigned long *freq, u32 flags)
>  
>  	if (old_freq < new_freq) {
>  		ret = regulator_set_voltage_tol(bus->regulator, new_volt, tol);
> -		if (ret < 0) {
> -			dev_err(bus->dev, "failed to set voltage\n");
> -			goto out;
> -		}
> +		if (ret < 0)
> +			goto report_failure;
>  	}
>  
>  	ret = clk_set_rate(bus->clk, new_freq);
>  	if (ret < 0) {
>  		dev_err(dev, "failed to change clock of bus\n");
>  		clk_set_rate(bus->clk, old_freq);
> -		goto out;
> +		goto unlock;
>  	}
>  
>  	if (old_freq > new_freq) {
>  		ret = regulator_set_voltage_tol(bus->regulator, new_volt, tol);
> -		if (ret < 0) {
> -			dev_err(bus->dev, "failed to set voltage\n");
> -			goto out;
> -		}
> +		if (ret < 0)
> +			goto report_failure;
>  	}
>  	bus->curr_freq = new_freq;
>  
>  	dev_dbg(dev, "Set the frequency of bus (%luHz -> %luHz, %luHz)\n",
>  			old_freq, new_freq, clk_get_rate(bus->clk));
> -out:
> +unlock:
>  	mutex_unlock(&bus->lock);
> -
>  	return ret;
> +
> +report_failure:
> +	dev_err(bus->dev, "failed to set voltage\n");
> +	goto unlock;
>  }
>  
>  static int exynos_bus_get_dev_status(struct device *dev,
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

  reply	other threads:[~2017-10-23  1:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20171022134057epcas4p43e6f37b8994c28f6ef240536349811a8@epcas4p4.samsung.com>
2017-10-22 13:40 ` [PATCH] devfreq/exynos-bus: Use common error handling code in exynos_bus_target() SF Markus Elfring
2017-10-22 13:40   ` SF Markus Elfring
2017-10-22 13:40   ` SF Markus Elfring
2017-10-23  1:17   ` Chanwoo Choi [this message]
2017-10-23  1:17     ` Chanwoo Choi
2017-10-23  1:17     ` Chanwoo Choi
2017-10-23  5:53     ` SF Markus Elfring
2017-10-23  5:53       ` SF Markus Elfring
2017-10-23  5:53       ` SF Markus Elfring

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=59ED4313.701@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.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.