diff mbox series

clk: samsung: Remove redundant check in samsung_cmu_register_one

Message ID 20200121233349.28627-1-pakki001@umn.edu (mailing list archive)
State Not Applicable
Headers show
Series clk: samsung: Remove redundant check in samsung_cmu_register_one | expand

Commit Message

Aditya Pakki Jan. 21, 2020, 11:33 p.m. UTC
Consistent with other instances of samsung_clk_init, the check
if ctx is NULL is redundant. The function currently does not
return NULL.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/clk/samsung/clk.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Chanwoo Choi Jan. 22, 2020, 1 a.m. UTC | #1
On 1/22/20 8:33 AM, Aditya Pakki wrote:
> Consistent with other instances of samsung_clk_init, the check
> if ctx is NULL is redundant. The function currently does not
> return NULL.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>  drivers/clk/samsung/clk.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c
> index dad31308c071..1949ae7851b2 100644
> --- a/drivers/clk/samsung/clk.c
> +++ b/drivers/clk/samsung/clk.c
> @@ -356,10 +356,6 @@ struct samsung_clk_provider * __init samsung_cmu_register_one(
>  	}
>  
>  	ctx = samsung_clk_init(np, reg_base, cmu->nr_clk_ids);
> -	if (!ctx) {
> -		panic("%s: unable to allocate ctx\n", __func__);
> -		return ctx;
> -	}
>  
>  	if (cmu->pll_clks)
>  		samsung_clk_register_pll(ctx, cmu->pll_clks, cmu->nr_pll_clks,
> 

If samsung_clk_init() fail to allocate the memory for 'ctx',
call panic() without return. As the patch description,
samsung_clk_init() either call panic() or return
the correct 'ctx' instance. It looks good to me.

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Stephen Boyd Feb. 12, 2020, 11:38 p.m. UTC | #2
Quoting Aditya Pakki (2020-01-21 15:33:49)
> Consistent with other instances of samsung_clk_init, the check
> if ctx is NULL is redundant. The function currently does not
> return NULL.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---

Applied to clk-next
diff mbox series

Patch

diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c
index dad31308c071..1949ae7851b2 100644
--- a/drivers/clk/samsung/clk.c
+++ b/drivers/clk/samsung/clk.c
@@ -356,10 +356,6 @@  struct samsung_clk_provider * __init samsung_cmu_register_one(
 	}
 
 	ctx = samsung_clk_init(np, reg_base, cmu->nr_clk_ids);
-	if (!ctx) {
-		panic("%s: unable to allocate ctx\n", __func__);
-		return ctx;
-	}
 
 	if (cmu->pll_clks)
 		samsung_clk_register_pll(ctx, cmu->pll_clks, cmu->nr_pll_clks,