Skip to contentSkip to conversation

mtd: s3c2410 nand: Remove uncessary null check

PATCH New jhbird.choi at samsung.com 4 participants 4 messages Jul 21, 2011 – Jul 22, 2011

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

PATCH 1/1 mtd: s3c2410 nand: Remove uncessary null check

From: Jonghwan Choi <[email protected]>

clk_get() return a pointer to the struct clk or an ERR_PTR().

---
 drivers/mtd/nand/s3c2410.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/s3c2410.c +1 -1
index 4405468..18ff2f5 100644
@@ -723,7 +723,7 @@ static int s3c24xx_nand_remove(struct platform_device *pdev)
 
 	/* free the common resources */
 
-	if (info->clk != NULL && !IS_ERR(info->clk)) {
+	if (!IS_ERR(info->clk)) {
 		s3c2410_nand_clk_set_state(info, CLOCK_DISABLE);
 		clk_put(info->clk);
 	}
Signature · 1 line
1.7.0
#1 lore raw

PATCH 1/1 mtd: s3c2410 nand: Remove uncessary null check

Quoted 14 lines · jhbird.choi at samsung.com

From: Jonghwan Choi <[email protected]>

clk_get() return a pointer to the struct clk or an ERR_PTR().

---
 drivers/mtd/nand/s3c2410.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/s3c2410.c +0 -0
index 4405468..18ff2f5 100644

drivers/mtd/nand/s3c2410.c static int s3c24xx_nand_remove(struct platform_device *pdev) · line 726

Quoted 5 lines
drivers/mtd/nand/s3c2410.c +1 -1
@@ -723,7 +723,7 @@ static int s3c24xx_nand_remove(struct platform_device *pdev)
 
 	/* free the common resources */
 
-	if (info->clk != NULL && !IS_ERR(info->clk)) {
+	if (!IS_ERR(info->clk)) {

I think you should use IS_ERR_OR_NULL instead.

Quoted 3 lines
drivers/mtd/nand/s3c2410.c +0 -0
 		s3c2410_nand_clk_set_state(info, CLOCK_DISABLE);
 		clk_put(info->clk);
 	}
#2 lore raw

PATCH 1/1 mtd: s3c2410 nand: Remove uncessary null check

Quoted 16 lines · Varun Wadekar
Quoted 15 lines · jhbird.choi at samsung.com

From: Jonghwan Choi <[email protected]>

clk_get() return a pointer to the struct clk or an ERR_PTR().

---
 drivers/mtd/nand/s3c2410.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/nand/s3c2410.c +0 -0
index 4405468..18ff2f5 100644
@@ -723,7 +723,7 @@ static int s3c24xx_nand_remove(struct platform_device *pdev)
 
Quoted 6 lines

drivers/mtd/nand/s3c2410.c static int s3c24xx_nand_remove(struct platform_device *pdev) · line 726

Quoted 4 lines
drivers/mtd/nand/s3c2410.c +1 -1
 	/* free the common resources */
 
-	if (info->clk != NULL && !IS_ERR(info->clk)) {
+	if (!IS_ERR(info->clk)) {

I think you should use IS_ERR_OR_NULL instead.

No. Jonghwan Choi's patch is correct.

As per the patch description, the only error value which a driver can attribute any problem with is something which passes IS_ERR(). Everything else the driver must treat as a _valid_ struct clk - and the clk API implementation must accept non-IS_ERR() clk_get() values.