Ver código fonte

mtd: mpc5121_nfc: don't treat NULL clk as an error

clk_get() returns a struct clk cookie to the driver and some platforms
may return NULL if they only support a single clock.  clk_get() has only
failed if it returns a ERR_PTR() encoded pointer.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Jamie Iles 14 anos atrás
pai
commit
83025c824f
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      drivers/mtd/nand/mpc5121_nfc.c

+ 3 - 2
drivers/mtd/nand/mpc5121_nfc.c

@@ -29,6 +29,7 @@
 #include <linux/clk.h>
 #include <linux/clk.h>
 #include <linux/gfp.h>
 #include <linux/gfp.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
+#include <linux/err.h>
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/io.h>
@@ -758,9 +759,9 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op,
 
 
 	/* Enable NFC clock */
 	/* Enable NFC clock */
 	prv->clk = clk_get(dev, "nfc_clk");
 	prv->clk = clk_get(dev, "nfc_clk");
-	if (!prv->clk) {
+	if (IS_ERR(prv->clk)) {
 		dev_err(dev, "Unable to acquire NFC clock!\n");
 		dev_err(dev, "Unable to acquire NFC clock!\n");
-		retval = -ENODEV;
+		retval = PTR_ERR(prv->clk);
 		goto error;
 		goto error;
 	}
 	}