Skip to contentSkip to conversation

clk: tegra: fix return value check in tegra_clk_register_pllc()

PATCH New Wei Yongjun 3 participants 3 messages Oct 29, 2013 – Nov 28, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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
index 197074a..a99bef7 100644
@@ -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);
#1 lore raw

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 not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

drivers/clk/tegra/clk-pll.c +1 -1
 	parent = __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.

#2 lore raw

PATCH 1/1 clk: tegra: fix return value check in tegra_clk_register_pllc()

In reply to Wei Yongjun
Quoted 17 lines · Wei Yongjun

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 +0 -0
index 197074a..a99bef7 100644

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.