From 68c9274d0fd1f66c6d105c52a61268d943e30862 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 20 Nov 2012 15:46:41 +0900 Subject: extcon: max8997: Fix incorrect error check and return value 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 Signed-off-by: Chanwoo Choi Signed-off-by: Myungjoo Ham --- drivers/extcon/extcon-max8997.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/extcon') diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index 77b66b0cc8f..a46c82f3183 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c @@ -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, -- cgit v1.2.3-70-g09d2