mfd: Fix s5m error handling for invalid device type
authorJonghwan Choi <jhbird.choi@samsung.com>
Mon, 20 Feb 2012 15:22:56 +0000 (16:22 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 6 Mar 2012 17:46:35 +0000 (18:46 +0100)
If device type is not supported in driver, have to retun error.

Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/s5m-irq.c

index de76dfb6f0ad2af82796c74d4d16a9abe3701bb9..0236676085cf096f6c4e0091ac3803d4f8fc1f3f 100644 (file)
@@ -342,7 +342,10 @@ int s5m_irq_resume(struct s5m87xx_dev *s5m87xx)
                        s5m8767_irq_thread(s5m87xx->irq_base, s5m87xx);
                        break;
                default:
-                       break;
+                       dev_err(s5m87xx->dev,
+                               "Unknown device type %d\n",
+                               s5m87xx->device_type);
+                       return -EINVAL;
 
                }
        }
@@ -444,7 +447,9 @@ int s5m_irq_init(struct s5m87xx_dev *s5m87xx)
                }
                break;
        default:
-               break;
+               dev_err(s5m87xx->dev,
+                       "Unknown device type %d\n", s5m87xx->device_type);
+               return -EINVAL;
        }
 
        if (!s5m87xx->ono)
@@ -467,12 +472,15 @@ int s5m_irq_init(struct s5m87xx_dev *s5m87xx)
                                        IRQF_ONESHOT, "s5m87xx-ono", s5m87xx);
                break;
        default:
+               ret = -EINVAL;
                break;
        }
 
-       if (ret)
+       if (ret) {
                dev_err(s5m87xx->dev, "Failed to request IRQ %d: %d\n",
                        s5m87xx->ono, ret);
+               return ret;
+       }
 
        return 0;
 }