Skip to contentSkip to conversation

clk: Fix return value check in oxnas_stdclk_probe()

PATCH New weiyj_lk at 163.com 3 participants 3 messages Jun 17, 2016 – Jun 21, 2016 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: Fix return value check in oxnas_stdclk_probe()

From: Wei Yongjun <[email protected]>

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().

---
 drivers/clk/clk-oxnas.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-oxnas.c +2 -2
index efba7d4..79bcb2e 100644
@@ -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++) {
#1 lore raw

PATCH 1/1 clk: Fix return value check in oxnas_stdclk_probe()

Quoted 20 lines · On 06/17/2016 07:24 PM, weiyj_lk at 163.com wrote:

From: Wei Yongjun <[email protected]>

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().

---
 drivers/clk/clk-oxnas.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-oxnas.c +0 -0
index efba7d4..79bcb2e 100644
@@ -144,9 +144,9 @@ static int oxnas_stdclk_probe(struct platform_device *pdev)
 		return -ENOMEM;

drivers/clk/clk-oxnas.c static int oxnas_stdclk_probe(struct platform_device *pdev) · line 152

Quoted 10 lines
drivers/clk/clk-oxnas.c +2 -2
 
 	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.

Thanks,
Neil

Applied
#2 lore raw

PATCH 1/1 clk: Fix return value check in oxnas_stdclk_probe()

In reply to weiyj_lk at 163.com
Quoted 8 lines · On 06/17, weiyj_lk at 163.com wrote:

From: Wei Yongjun <[email protected]>

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().

---

Applied to clk-fixes + added fixes tag.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project