Received: by 10.223.164.202 with SMTP id h10csp2376381wrb; Sun, 12 Nov 2017 07:53:47 -0800 (PST) X-Google-Smtp-Source: AGs4zMb15FcWS1pWMESsMqzELxRYgRzHTillBiLuI+1QXBalD530mIzKvWkc3f3MpbCyQ07t4Biv X-Received: by 10.84.133.15 with SMTP id 15mr4994514plf.367.1510502026989; Sun, 12 Nov 2017 07:53:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510502026; cv=none; d=google.com; s=arc-20160816; b=1E1hUtiisToqO6J3DASv763taSh+EkuStn1SRISrKvSTId6F+tBEal6qx6RIVTm4XG fxryyUQA8EBQmFhoMmlES6k4I+/5wagR2nDKrqwdbAAjPbib20QYg9l2KpetKIdSEk2k kiww+lwha+OzteGSzK1sN1wLiMIKVMb7llFkzOdSTqHAO9YslOqWPBfAcZqEN7BUy+We uhPoPsajEkIu9tMfEhkpgzzyuBPlqyyzZMUr/t8PPMvt6R5doOvA83bOpYXLciqrtSky bez/BWFcrhwUyJN+bRXULLWOkTYglWdkxcUgCLUQJCQnsAhCbIbzQYWyEwkKBvMb+BDj Ub8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=H9ycIuW1cG0maCPEi5x5/ldDwzIXCzol8AhjHHpXDi8=; b=BY1MD1EmBOhscAuPVci9FJgzIFSya4TOukI5EuA2QAH7rSY7N8Tmt0A7U3h3JYzg8U aOA++W+TfdJlinLlO2mMubvdTyLjoIgnR4HwrHrYx44rUafP2a4wqmW9+5/us2q7oEt0 onkKP/nrOhDTJ9IQmBFeC2JaT1jYPnRX+aTTSfgF+t8fq+nvSVwhxH82Q+XSFjFywl5p lva4ZwbJXXDphtUm3fYLZDQHpPdTGg0KYAD2Ujn+kb61F5+D3DLlepWkYve19ic9lo6G oTiWgU4GBOrzxEtjvF9iQUVGJ4Xgo7G5jTh+DO90ZkAZOrdR1alNGgmuldw4llvOZvdG apgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=P5oSr+se; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si10970671pld.419.2017.11.12.07.53.24; Sun, 12 Nov 2017 07:53:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=P5oSr+se; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751544AbdKLPw2 (ORCPT + 87 others); Sun, 12 Nov 2017 10:52:28 -0500 Received: from m12-14.163.com ([220.181.12.14]:57846 "EHLO m12-14.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751220AbdKLPw0 (ORCPT ); Sun, 12 Nov 2017 10:52:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=H9ycIuW1cG0maCPEi5 x5/ldDwzIXCzol8AhjHHpXDi8=; b=P5oSr+seGoYWpveHs41v7LzVO34gEXKo5P pIwm70lEYM5KPkTJI5HrtUoUOKFMy7ab9nUv0duO8cTUKWFVw2JnV7dRwp+ArUj8 QLRc6a597Ftxntfhq7Wo1zd9Mj8W87LGOcGT63Aufwy4rjhqafF5CgFNO0DJYGel QxdICsqws= Received: from localhost.localdomain (unknown [106.120.213.14]) by smtp10 (Coremail) with SMTP id DsCowACX2cYjbghagIIDDA--.59255S3; Sun, 12 Nov 2017 23:52:10 +0800 (CST) From: Pan Bian To: Sebastian Reichel Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH] power: supply: cpcap-charger: fix incorrect return value check Date: Sun, 12 Nov 2017 23:52:02 +0800 Message-Id: <1510501922-19163-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DsCowACX2cYjbghagIIDDA--.59255S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Xw4DuryfWF48tFyUCFy8Krg_yoWDJrgE93 y2g3929r4F9Fn0vwn0qF4fAF92kryxWrnrWF4ktF13Za4a9wsYv397ZFn5XF48Wry3CrWq 9FZYkFs3AryfJjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU0znmtUUUUU== X-Originating-IP: [106.120.213.14] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiQA+OclSIT6qCCgABsD Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function platform_get_irq_byname() returns a negative error code on failure, and a zero or positive number on success. However, in function cpcap_usb_init_irq(), positive IRQ numbers are also taken as error cases. Use "if (irq < 0)" instead of "if (!irq)" to validate the return value of platform_get_irq_byname(). Signed-off-by: Pan Bian --- drivers/power/supply/cpcap-charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c index 11a0763..e4905be 100644 --- a/drivers/power/supply/cpcap-charger.c +++ b/drivers/power/supply/cpcap-charger.c @@ -484,7 +484,7 @@ static int cpcap_usb_init_irq(struct platform_device *pdev, int irq, error; irq = platform_get_irq_byname(pdev, name); - if (!irq) + if (irq < 0) return -ENODEV; error = devm_request_threaded_irq(ddata->dev, irq, NULL, -- 1.9.1 From 1583775783881773653@xxx Sat Nov 11 13:18:08 +0000 2017 X-GM-THRID: 1583775783881773653 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread