mfd: max77686: check the interrupt is specified or not
authorHyungwon Hwang <human.hwang@samsung.com>
Fri, 20 Jun 2014 11:05:27 +0000 (20:05 +0900)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:59:52 +0000 (11:59 +0900)
For the cases which the interrupt for this device is not specified, it must be
checked whether it is or not. Without it, an error occurs, because some
operations are done on the interrupt number which is not specified well.

Change-Id: Idc0a4b0f1e99f0f1022795927c54c1d3f56a4459
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
drivers/mfd/max77686.c

index 436a0c1..e23ccef 100644 (file)
@@ -191,6 +191,9 @@ static int max77686_suspend(struct device *dev)
        struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
        struct max77686_dev *max77686 = i2c_get_clientdata(i2c);
 
+       if (!max77686->irq)
+               return 0;
+
        if (device_may_wakeup(dev))
                enable_irq_wake(max77686->irq);
 
@@ -208,6 +211,9 @@ static int max77686_resume(struct device *dev)
        struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
        struct max77686_dev *max77686 = i2c_get_clientdata(i2c);
 
+       if (!max77686->irq)
+               return 0;
+
        if (device_may_wakeup(dev))
                disable_irq_wake(max77686->irq);