]> git.karo-electronics.de Git - linux-beck.git/commitdiff
extcon: max8997: Fix incorrect error check and return value
authorSachin Kamat <sachin.kamat@linaro.org>
Tue, 20 Nov 2012 06:46:41 +0000 (15:46 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 21 Nov 2012 11:00:40 +0000 (20:00 +0900)
irq_create_mapping() returns 0 if it fails to provide a valid irq number.
'ret' needs to be updated with a negative error code before returning from
probe to signal probe failure. While at it, also corrected the 'virq' type to
unsigned from signed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
drivers/extcon/extcon-max8997.c

index 77b66b0cc8f54b117280e951daf81b17d6d31c3c..a46c82f31837af010d7af20e8c2611907c25fdef 100644 (file)
@@ -450,11 +450,13 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev)
 
        for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) {
                struct max8997_muic_irq *muic_irq = &muic_irqs[i];
-               int virq = 0;
+               unsigned int virq = 0;
 
                virq = irq_create_mapping(max8997->irq_domain, muic_irq->irq);
-               if (!virq)
+               if (!virq) {
+                       ret = -EINVAL;
                        goto err_irq;
+               }
                muic_irq->virq = virq;
 
                ret = request_threaded_irq(virq, NULL,max8997_muic_irq_handler,