From patchwork Tue Nov 20 05:22:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 12963 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 86B6523FC2 for ; Tue, 20 Nov 2012 05:29:07 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 37BEEA18F7F for ; Tue, 20 Nov 2012 05:29:07 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so1484290iag.11 for ; Mon, 19 Nov 2012 21:29:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=woj7bAWYiBt0F1rNEC+hgPlCcSf/0tzJOGBxTvllePc=; b=Tj4CIuOXtBGYuCR80odHnaYIEbYpoW75FswNWo8Y1+hK3LAzsVnI+SY3Rpth9bNMDP 9G0qfiZ+db7yZda/+3xnQ2Yt9nZuaPgaTwaGo9c6FVNitMlEdVH5ixSZQBMSTopavRNt dGHk9o1q6FuhM6WBBaZDLjvfvXtywuoaykjYXKRHSEDidmWcvNCH4t/BVXxKdVu4L9rT xe1UfSSnP2YeKoA1bvFQ2YG+31cDDNo/1oIt98dkT7HDWBhOR0dIAivaW+H5a/6E5bsN /wTNwrQtsDIRfJM6XzRKOIi705om7BQxA7yhbiLD+OeAhMBqUd7Pl2zAjGFFNh4sRPeH loRw== Received: by 10.50.173.34 with SMTP id bh2mr8776162igc.70.1353389346660; Mon, 19 Nov 2012 21:29:06 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp271273igt; Mon, 19 Nov 2012 21:29:06 -0800 (PST) Received: by 10.66.74.65 with SMTP id r1mr4930244pav.75.1353389346108; Mon, 19 Nov 2012 21:29:06 -0800 (PST) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id v5si16385789paz.144.2012.11.19.21.29.05 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Nov 2012 21:29:06 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.47; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pa0-f47.google.com with SMTP id fa11so3552128pad.6 for ; Mon, 19 Nov 2012 21:29:05 -0800 (PST) Received: by 10.66.72.225 with SMTP id g1mr4928952pav.79.1353389345875; Mon, 19 Nov 2012 21:29:05 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id d2sm7429712paw.19.2012.11.19.21.29.02 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Nov 2012 21:29:05 -0800 (PST) From: Sachin Kamat To: linux-kernel@vger.kernel.org Cc: myungjoo.ham@samsung.com, cw00.choi@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 4/7] extcon: max8997: Fix incorrect error check and return value Date: Tue, 20 Nov 2012 10:52:40 +0530 Message-Id: <1353388963-23761-5-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353388963-23761-1-git-send-email-sachin.kamat@linaro.org> References: <1353388963-23761-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQlyWD6sHhB4J3elJsANRqLHq6iimIaCe/MPIvGgkxdVmylSyIB6WuXBmWdxRN6mJ7K6f49W 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 --- drivers/extcon/extcon-max8997.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index af8a5bc..ffdbe8c 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,