clk: Fix return value check in oxnas_stdclk_probe()
diff mbox

Message ID 1466184263-17890-1-git-send-email-weiyj_lk@163.com
State Accepted, archived
Delegated to: Stephen Boyd
Headers show

Commit Message

weiyj_lk@163.com June 17, 2016, 5:24 p.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, the function syscon_node_to_regmap() returns
ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/clk/clk-oxnas.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)




--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Neil Armstrong June 20, 2016, 10:03 a.m. UTC | #1
On 06/17/2016 07:24 PM, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function syscon_node_to_regmap() returns
> ERR_PTR() and never returns NULL. The NULL test in the return
> value check should be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/clk/clk-oxnas.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/clk-oxnas.c b/drivers/clk/clk-oxnas.c
> index efba7d4..79bcb2e 100644
> --- a/drivers/clk/clk-oxnas.c
> +++ b/drivers/clk/clk-oxnas.c
> @@ -144,9 +144,9 @@ static int oxnas_stdclk_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	regmap = syscon_node_to_regmap(of_get_parent(np));
> -	if (!regmap) {
> +	if (IS_ERR(regmap)) {
>  		dev_err(&pdev->dev, "failed to have parent regmap\n");
> -		return -EINVAL;
> +		return PTR_ERR(regmap);
>  	}
>  
>  	for (i = 0; i < ARRAY_SIZE(clk_oxnas_init); i++) {
> 
> 
> 
Correct.

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

Thanks,
Neil
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd June 21, 2016, midnight UTC | #2
On 06/17, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function syscon_node_to_regmap() returns
> ERR_PTR() and never returns NULL. The NULL test in the return
> value check should be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---

Applied to clk-fixes + added fixes tag.

Patch
diff mbox

diff --git a/drivers/clk/clk-oxnas.c b/drivers/clk/clk-oxnas.c
index efba7d4..79bcb2e 100644
--- a/drivers/clk/clk-oxnas.c
+++ b/drivers/clk/clk-oxnas.c
@@ -144,9 +144,9 @@  static int oxnas_stdclk_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	regmap = syscon_node_to_regmap(of_get_parent(np));
-	if (!regmap) {
+	if (IS_ERR(regmap)) {
 		dev_err(&pdev->dev, "failed to have parent regmap\n");
-		return -EINVAL;
+		return PTR_ERR(regmap);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(clk_oxnas_init); i++) {