mtd: mxc-nand: no need to check for validity of platform driver data

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Feb 25 07:59:03 EST 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=b840bc11b5062803c204d8a9625a1a1c5812d6d6
Commit:     b840bc11b5062803c204d8a9625a1a1c5812d6d6
Parent:     17fabf156507ec0f688f1e58be02f38e04de0c6e
Author:     Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
AuthorDate: Mon Jan 11 15:05:35 2010 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Thu Feb 25 11:28:06 2010 +0000

    mtd: mxc-nand: no need to check for validity of platform driver data
    
    The probe function calls platform_set_drvdata with a valid pointer when
    the probe is successful.  As mxcnd_suspend and mxcnd_resume are only
    called on bound devices, platform_get_drvdata always returns non-NULL.
    
    This fix isn't critical as the pointer is always valid so it doesn't
    matter if the compiler generated code for it or not.
    
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
    Reported-by: David Binderman <dcb314 at hotmail.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Acked-by: Sascha Hauer <s.hauer at pengutronix.de>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/mxc_nand.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 45dec57..84f3635 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -886,11 +886,10 @@ static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
 	int ret = 0;
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n");
-	if (mtd) {
-		ret = mtd->suspend(mtd);
-		/* Disable the NFC clock */
-		clk_disable(host->clk);
-	}
+
+	ret = mtd->suspend(mtd);
+	/* Disable the NFC clock */
+	clk_disable(host->clk);
 
 	return ret;
 }
@@ -904,11 +903,9 @@ static int mxcnd_resume(struct platform_device *pdev)
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n");
 
-	if (mtd) {
-		/* Enable the NFC clock */
-		clk_enable(host->clk);
-		mtd->resume(mtd);
-	}
+	/* Enable the NFC clock */
+	clk_enable(host->clk);
+	mtd->resume(mtd);
 
 	return ret;
 }



More information about the linux-mtd-cvs mailing list