All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: samsung: exynos5433: Fix error paths
       [not found] <CGME20191002085320eucas1p2e4c35fe7783deb38fbd2e9f87f4f1234@eucas1p2.samsung.com>
@ 2019-10-02  8:53 ` Marek Szyprowski
  2019-10-02  9:07   ` Krzysztof Kozlowski
                     ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Marek Szyprowski @ 2019-10-02  8:53 UTC (permalink / raw)
  To: linux-clk, linux-samsung-soc
  Cc: Marek Szyprowski, Sylwester Nawrocki, Chanwoo Choi,
	Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Add checking the value returned by samsung_clk_alloc_reg_dump() and
devm_kcalloc(). While fixing this, also release all gathered clocks.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/clk/samsung/clk-exynos5433.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c
index 7824c2ba3d8e..0b60316331a0 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -5584,6 +5584,8 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev)
 
 	data->clk_save = samsung_clk_alloc_reg_dump(info->clk_regs,
 						    info->nr_clk_regs);
+	if (!data->clk_save)
+		return -ENOMEM;
 	data->nr_clk_save = info->nr_clk_regs;
 	data->clk_suspend = info->suspend_regs;
 	data->nr_clk_suspend = info->nr_suspend_regs;
@@ -5592,12 +5594,19 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev)
 	if (data->nr_pclks > 0) {
 		data->pclks = devm_kcalloc(dev, sizeof(struct clk *),
 					   data->nr_pclks, GFP_KERNEL);
-
+		if (!data->pclks) {
+			kfree(data->clk_save);
+			return -ENOMEM;
+		}
 		for (i = 0; i < data->nr_pclks; i++) {
 			struct clk *clk = of_clk_get(dev->of_node, i);
 
-			if (IS_ERR(clk))
+			if (IS_ERR(clk)) {
+				kfree(data->clk_save);
+				while (--i >= 0)
+					clk_put(data->pclks[i]);
 				return PTR_ERR(clk);
+			}
 			data->pclks[i] = clk;
 		}
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: samsung: exynos5433: Fix error paths
  2019-10-02  8:53 ` [PATCH] clk: samsung: exynos5433: Fix error paths Marek Szyprowski
@ 2019-10-02  9:07   ` Krzysztof Kozlowski
  2019-10-03 23:07   ` Chanwoo Choi
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2019-10-02  9:07 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-clk, linux-samsung-soc, Sylwester Nawrocki, Chanwoo Choi,
	Bartlomiej Zolnierkiewicz

On Wed, Oct 02, 2019 at 10:53:09AM +0200, Marek Szyprowski wrote:
> Add checking the value returned by samsung_clk_alloc_reg_dump() and
> devm_kcalloc(). While fixing this, also release all gathered clocks.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/clk/samsung/clk-exynos5433.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: samsung: exynos5433: Fix error paths
  2019-10-02  8:53 ` [PATCH] clk: samsung: exynos5433: Fix error paths Marek Szyprowski
  2019-10-02  9:07   ` Krzysztof Kozlowski
@ 2019-10-03 23:07   ` Chanwoo Choi
  2019-10-04 21:45   ` Stephen Boyd
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Chanwoo Choi @ 2019-10-03 23:07 UTC (permalink / raw)
  To: Marek Szyprowski, linux-clk, linux-samsung-soc
  Cc: Sylwester Nawrocki, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

On 19. 10. 2. 오후 5:53, Marek Szyprowski wrote:
> Add checking the value returned by samsung_clk_alloc_reg_dump() and
> devm_kcalloc(). While fixing this, also release all gathered clocks.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/clk/samsung/clk-exynos5433.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c
> index 7824c2ba3d8e..0b60316331a0 100644
> --- a/drivers/clk/samsung/clk-exynos5433.c
> +++ b/drivers/clk/samsung/clk-exynos5433.c
> @@ -5584,6 +5584,8 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev)
>  
>  	data->clk_save = samsung_clk_alloc_reg_dump(info->clk_regs,
>  						    info->nr_clk_regs);
> +	if (!data->clk_save)
> +		return -ENOMEM;
>  	data->nr_clk_save = info->nr_clk_regs;
>  	data->clk_suspend = info->suspend_regs;
>  	data->nr_clk_suspend = info->nr_suspend_regs;
> @@ -5592,12 +5594,19 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev)
>  	if (data->nr_pclks > 0) {
>  		data->pclks = devm_kcalloc(dev, sizeof(struct clk *),
>  					   data->nr_pclks, GFP_KERNEL);
> -
> +		if (!data->pclks) {
> +			kfree(data->clk_save);
> +			return -ENOMEM;
> +		}
>  		for (i = 0; i < data->nr_pclks; i++) {
>  			struct clk *clk = of_clk_get(dev->of_node, i);
>  
> -			if (IS_ERR(clk))
> +			if (IS_ERR(clk)) {
> +				kfree(data->clk_save);
> +				while (--i >= 0)
> +					clk_put(data->pclks[i]);
>  				return PTR_ERR(clk);
> +			}
>  			data->pclks[i] = clk;
>  		}
>  	}
> 

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: samsung: exynos5433: Fix error paths
  2019-10-02  8:53 ` [PATCH] clk: samsung: exynos5433: Fix error paths Marek Szyprowski
  2019-10-02  9:07   ` Krzysztof Kozlowski
  2019-10-03 23:07   ` Chanwoo Choi
@ 2019-10-04 21:45   ` Stephen Boyd
  2019-10-07  6:25     ` Marek Szyprowski
  2019-10-07  8:54   ` Sylwester Nawrocki
  2019-10-23 12:57   ` Sylwester Nawrocki
  4 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2019-10-04 21:45 UTC (permalink / raw)
  To: Marek Szyprowski, linux-clk, linux-samsung-soc
  Cc: Marek Szyprowski, Sylwester Nawrocki, Chanwoo Choi,
	Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Quoting Marek Szyprowski (2019-10-02 01:53:09)
> Add checking the value returned by samsung_clk_alloc_reg_dump() and
> devm_kcalloc(). While fixing this, also release all gathered clocks.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---

Any fixes tag?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: samsung: exynos5433: Fix error paths
  2019-10-04 21:45   ` Stephen Boyd
@ 2019-10-07  6:25     ` Marek Szyprowski
  0 siblings, 0 replies; 7+ messages in thread
From: Marek Szyprowski @ 2019-10-07  6:25 UTC (permalink / raw)
  To: Stephen Boyd, linux-clk, linux-samsung-soc
  Cc: Sylwester Nawrocki, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz

On 04.10.2019 23:45, Stephen Boyd wrote:
> Quoting Marek Szyprowski (2019-10-02 01:53:09)
>> Add checking the value returned by samsung_clk_alloc_reg_dump() and
>> devm_kcalloc(). While fixing this, also release all gathered clocks.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
> Any fixes tag?

Fixes: 523d3de41f02 ("clk: samsung: exynos5433: Add support for runtime PM")

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: samsung: exynos5433: Fix error paths
  2019-10-02  8:53 ` [PATCH] clk: samsung: exynos5433: Fix error paths Marek Szyprowski
                     ` (2 preceding siblings ...)
  2019-10-04 21:45   ` Stephen Boyd
@ 2019-10-07  8:54   ` Sylwester Nawrocki
  2019-10-23 12:57   ` Sylwester Nawrocki
  4 siblings, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2019-10-07  8:54 UTC (permalink / raw)
  To: Marek Szyprowski, Stephen Boyd
  Cc: linux-clk, linux-samsung-soc, Sylwester Nawrocki, Chanwoo Choi,
	Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

On 10/2/19 10:53, Marek Szyprowski wrote:
> Add checking the value returned by samsung_clk_alloc_reg_dump() and
> devm_kcalloc(). While fixing this, also release all gathered clocks.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] clk: samsung: exynos5433: Fix error paths
  2019-10-02  8:53 ` [PATCH] clk: samsung: exynos5433: Fix error paths Marek Szyprowski
                     ` (3 preceding siblings ...)
  2019-10-07  8:54   ` Sylwester Nawrocki
@ 2019-10-23 12:57   ` Sylwester Nawrocki
  4 siblings, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2019-10-23 12:57 UTC (permalink / raw)
  To: Marek Szyprowski, linux-clk
  Cc: linux-samsung-soc, Sylwester Nawrocki, Chanwoo Choi,
	Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

On 10/2/19 10:53, Marek Szyprowski wrote:
> Add checking the value returned by samsung_clk_alloc_reg_dump() and
> devm_kcalloc(). While fixing this, also release all gathered clocks.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-10-23 12:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20191002085320eucas1p2e4c35fe7783deb38fbd2e9f87f4f1234@eucas1p2.samsung.com>
2019-10-02  8:53 ` [PATCH] clk: samsung: exynos5433: Fix error paths Marek Szyprowski
2019-10-02  9:07   ` Krzysztof Kozlowski
2019-10-03 23:07   ` Chanwoo Choi
2019-10-04 21:45   ` Stephen Boyd
2019-10-07  6:25     ` Marek Szyprowski
2019-10-07  8:54   ` Sylwester Nawrocki
2019-10-23 12:57   ` Sylwester Nawrocki

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.