Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1383484 > unrolled thread

[PATCH 2/2] mfd: twl6040: Check clk_prepare_enable() return value in twl6040_power()

Started byJavier Martinez Canillas <javier@osg.samsung.com>
First post2016-04-20 17:20 +0200
Last post2016-04-25 18:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] mfd: twl6040: Check clk_prepare_enable() return value in twl6040_power() Javier Martinez Canillas <javier@osg.samsung.com> - 2016-04-20 17:20 +0200
    Re: [PATCH 2/2] mfd: twl6040: Check clk_prepare_enable() return  value in twl6040_power() Lee Jones <lee.jones@linaro.org> - 2016-04-25 18:20 +0200

#1383484 — [PATCH 2/2] mfd: twl6040: Check clk_prepare_enable() return value in twl6040_power()

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-04-20 17:20 +0200
Subject[PATCH 2/2] mfd: twl6040: Check clk_prepare_enable() return value in twl6040_power()
Message-ID<rq253-1rF-5@gated-at.bofh.it>
The clk_prepare_enable() function can fail so check the return
value and propagate the error in case of a failure.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

 drivers/mfd/twl6040.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 4de92c16dfb8..852d5874aabb 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -291,7 +291,11 @@ int twl6040_power(struct twl6040 *twl6040, int on)
 		if (twl6040->power_count++)
 			goto out;
 
-		clk_prepare_enable(twl6040->clk32k);
+		ret = clk_prepare_enable(twl6040->clk32k);
+		if (ret) {
+			twl6040->power_count = 0;
+			goto out;
+		}
 
 		/* Allow writes to the chip */
 		regcache_cache_only(twl6040->regmap, false);
-- 
2.5.5

[toc] | [next] | [standalone]


#1386633 — Re: [PATCH 2/2] mfd: twl6040: Check clk_prepare_enable() return value in twl6040_power()

FromLee Jones <lee.jones@linaro.org>
Date2016-04-25 18:20 +0200
SubjectRe: [PATCH 2/2] mfd: twl6040: Check clk_prepare_enable() return value in twl6040_power()
Message-ID<rrRoT-mn-9@gated-at.bofh.it>
In reply to#1383484
On Wed, 20 Apr 2016, Javier Martinez Canillas wrote:

> The clk_prepare_enable() function can fail so check the return
> value and propagate the error in case of a failure.
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> 
> ---
> 
>  drivers/mfd/twl6040.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
> index 4de92c16dfb8..852d5874aabb 100644
> --- a/drivers/mfd/twl6040.c
> +++ b/drivers/mfd/twl6040.c
> @@ -291,7 +291,11 @@ int twl6040_power(struct twl6040 *twl6040, int on)
>  		if (twl6040->power_count++)
>  			goto out;
>  
> -		clk_prepare_enable(twl6040->clk32k);
> +		ret = clk_prepare_enable(twl6040->clk32k);
> +		if (ret) {
> +			twl6040->power_count = 0;
> +			goto out;
> +		}
>  
>  		/* Allow writes to the chip */
>  		regcache_cache_only(twl6040->regmap, false);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web