Received: by 10.223.164.202 with SMTP id h10csp2383242wrb; Sun, 12 Nov 2017 08:02:58 -0800 (PST) X-Google-Smtp-Source: AGs4zMazVqmQ9/9WY1kH7E0E/vYxjzSJvwmV2VA3+5FeKxvsFewTj+QHgdOy4uVUyp97wVxp6qP9 X-Received: by 10.98.158.211 with SMTP id f80mr6921122pfk.156.1510502578110; Sun, 12 Nov 2017 08:02:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510502578; cv=none; d=google.com; s=arc-20160816; b=BQcsAM8TvL1kuB06l7H3Hq9swbu8GmnhJv1+cd9i51uM+SdCDj++mG95dTMHkn1P9N aA+B43LXqi9FvG6ecluQ9dhsIITI2WnehzGvecrLohAG74D7Zul6cyUoXe5mF+EUE4i1 n1WbvGQZCmGDlLKA5MVXWRbFDVhz+bFR0rnfOvdXvKsX6Xxl5CorCgE87uZqW+mOV7C9 ZJeapYRyFOJsy0a3UdtuIZBwJJvVcPJGd4Nhnarud3fHHZtKgE0fOcB7kIEVkmEQjgrQ b5pNoK9z8gPFS4Jt2iGgiZMwAxXp3YIYvcZvBv9udDtRhesEGV6J56wuA01N9ktKd8Bj JISw== 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=i0EISzrYupQeprrRdRK32cuVSyTUclUDnCcKoXa+K+Y=; b=bpUaH7MpUeOl+sDsUzrKEQrOygCFqC4/V09/O6+iEPcveSf0yr6NjiQlY6mdlY1IAu 37G0RuW4HzDcK9REDsMPn5Pps5AF+Y4wT67VobyponMMYgNWe5+xxeC6g5D//8HG2qPO 5lvO3inB4w60uEduazh/3SShhqYLyZziFV71Pshux7BKbFbh5u2T/pG+6eNrdL90r74R ElUnE+jH2wTiJz6siezxZVhamEMv5gaZLCNxK7Kd5PGq3a/zdXmK+D897XkEPy0necYj lL1zlZg+f+rygTCIya7eTZK9n5XrpyFOHNbUG8WNKvu9qOqee+T+sYQKp2ZnrasJVluz NV7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=EozfQ6PZ; 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 z2si12320898pgo.219.2017.11.12.08.02.44; Sun, 12 Nov 2017 08:02:58 -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=EozfQ6PZ; 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 S1751577AbdKLQCF (ORCPT + 87 others); Sun, 12 Nov 2017 11:02:05 -0500 Received: from m12-13.163.com ([220.181.12.13]:43365 "EHLO m12-13.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751249AbdKLQCD (ORCPT ); Sun, 12 Nov 2017 11:02:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=i0EISzrYupQeprrRdR K32cuVSyTUclUDnCcKoXa+K+Y=; b=EozfQ6PZ7XvIBV0fo4W9NnwM3tzD4d0Ut+ VI+haqape/EZI0cLpCKMir91zHOwTBRpbbnxwa1zJxbeixvdG9PIXBaPl3xsYbxf HkGFQSz550Cc0oItdKKYUSqgVF19As82FOqvy194y+InJ2EbihgSzUO+eR/TwiLI Bg3U9KDJI= Received: from localhost.localdomain (unknown [106.120.213.14]) by smtp9 (Coremail) with SMTP id DcCowADXjl5ccAha7XvwQA--.19879S3; Mon, 13 Nov 2017 00:01:36 +0800 (CST) From: Pan Bian To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Tony Lindgren , Sebastian Reichel , Rob Herring Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH] iio: adc: cpcap: fix incorrect validation Date: Mon, 13 Nov 2017 00:01:20 +0800 Message-Id: <1510502480-27117-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DcCowADXjl5ccAha7XvwQA--.19879S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Xw4DuryfWF48tFyUGrykXwb_yoWDXFc_uw 42gwsrJrs7AFs0vw4Utr4fZFyvkF97JF1kZa4ktFy3u3sxGas3Kw10vF4rXFs7Ww1jqa4U urn5uFZ3C3y3AjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8czVUUUUUU== X-Originating-IP: [106.120.213.14] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiQA+OclSIT6qCCgADsB 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_adc_probe(), positive IRQ numbers are also taken as error cases. Use "if (ddata->irq < 0)" instead of "if (!ddata->irq)" to validate the return value of platform_get_irq_byname(). Signed-off-by: Pan Bian --- drivers/iio/adc/cpcap-adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/cpcap-adc.c b/drivers/iio/adc/cpcap-adc.c index 6e419d5..f153e026 100644 --- a/drivers/iio/adc/cpcap-adc.c +++ b/drivers/iio/adc/cpcap-adc.c @@ -1012,7 +1012,7 @@ static int cpcap_adc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, indio_dev); ddata->irq = platform_get_irq_byname(pdev, "adcdone"); - if (!ddata->irq) + if (ddata->irq < 0) return -ENODEV; error = devm_request_threaded_irq(&pdev->dev, ddata->irq, NULL, -- 1.9.1 From 1584466851032666027@xxx Sun Nov 19 04:22:21 +0000 2017 X-GM-THRID: 1584466851032666027 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread