clk: tegra: fix return value check in tegra_clk_register_pllc()
Subsystems (3)
PATCH 1/1 clk: tegra: fix return value check in tegra_clk_register_pllc()
From: Wei Yongjun <[email protected]>
In case of error, the function __clk_lookup() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.
--- drivers/clk/tegra/clk-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/tegra/clk-pll.c +1 -1
@@ -1507,7 +1507,7 @@ struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name,return ERR_PTR (-EINVAL ); parent =__clk_lookup (parent_name); -if (IS_ERR (parent)) { +if (!parent) {WARN (1 ,"parent clk %s of %s must be registered first\n" , name, parent_name);return ERR_PTR (-EINVAL );
PATCH 1/1 clk: tegra: fix return value check in tegra_clk_register_pllc()
drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, · line 1510
Quoted 9 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
In case of error, the function
__clk_lookup()returns NULL pointer notERR_PTR(). TheIS_ERR()test in the return value check should be replaced with NULL test.drivers/clk/tegra/clk-pll.c +1
-1parent =__clk_lookup (parent_name); -if (IS_ERR (parent)) { +if (!parent) {
clk_get() returns an error-value. It'd be nice if the internal clk APIs all did the same for consistency... Otherwise, the clock subsystem is essentially using both NULL and error-values as errors, which is rather frowned upon.
PATCH 1/1 clk: tegra: fix return value check in tegra_clk_register_pllc()
In reply to Wei YongjunQuoted 17 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
In case of error, the function
__clk_lookup()returns NULL pointer notERR_PTR(). TheIS_ERR()test in the return value check should be replaced with NULL test.Signed-off-by Wei Yongjun <[email protected]>--- drivers/clk/tegra/clk-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/tegra/clk-pll.c +0
-0
drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, · line 1513
Quoted 8 lines
drivers/clk/tegra/clk-pll.c +1
-1@@ -1507,7 +1507,7 @@ struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name,return ERR_PTR (-EINVAL ); parent =__clk_lookup (parent_name); -if (IS_ERR (parent)) { +if (!parent) {WARN (1 ,"parent clk %s of %s must be registered first\n" , name, parent_name);return ERR_PTR (-EINVAL );
Ah :( There are a few more instances of this. I will fix them all.