From patchwork Thu Aug 28 13:14:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 4804501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AD07D9F38C for ; Thu, 28 Aug 2014 13:19:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1544F200BE for ; Thu, 28 Aug 2014 13:19:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 965B120145 for ; Thu, 28 Aug 2014 13:19:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XMzXX-0002HI-10; Thu, 28 Aug 2014 13:14:59 +0000 Received: from mail-ie0-f172.google.com ([209.85.223.172]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XMzXT-000168-T3 for linux-arm-kernel@lists.infradead.org; Thu, 28 Aug 2014 13:14:56 +0000 Received: by mail-ie0-f172.google.com with SMTP id rd18so907084iec.31 for ; Thu, 28 Aug 2014 06:14:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bKsdiqUjmwinvGwalxYLmp91QMQX5B3eCAHd9NniANI=; b=Eant3j8vOVKot3TTvuzKYOxwHG32VbHt9pmMQJl0y1q5JC+wOHP3REuibPSgduBlMt Ls1GzWV488y9oQWuV/xNd0q39Cv96azzah1Z9amHR4kglEAK1UBKy/fJVhuiJ8N5tsZK u1MOIxqHN3t5Fe8lV9KsE9U5QnJZ8UN4YIuX5s88eeqMtLew5tmD5UJ5dCTFPz0wDwmD /VeCaWF0tE4gkNqoXcefYROe3gh2MUXkxbwaOa5MMuS6zjTTS2fAJw8VfTSNcHcMehT4 6ZiWiXeOyXk/T1qDqbHPBTCZ+w2/xic6upEgaM77J4KujpiJ9aLsRtXOq2s1aSRYH4U1 O4wQ== X-Gm-Message-State: ALoCoQlMUTHSBa243J9BWs0BmeBJTTL989B5589eUgsNxUvhx/Tvzzg7vBgDognsEUixG5T0is87 X-Received: by 10.50.61.138 with SMTP id p10mr38033396igr.20.1409231671658; Thu, 28 Aug 2014 06:14:31 -0700 (PDT) Received: from localhost.localdomain (host86-152-0-170.range86-152.btcentralplus.com. [86.152.0.170]) by mx.google.com with ESMTPSA id w8sm16633672igl.13.2014.08.28.06.14.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Aug 2014 06:14:31 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/11] iio: sensors-core: st: Check st_sensors_set_drdy_int_pin()'s return value Date: Thu, 28 Aug 2014 14:14:07 +0100 Message-Id: <1409231657-18294-1-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140828_061455_987160_BFD5DB73 X-CRM114-Status: GOOD ( 11.69 ) X-Spam-Score: -0.7 (/) Cc: linux-iio@vger.kernel.org, Lee Jones , jic23@kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Value from st_sensors_set_drdy_int_pin() is assigned to err here, but that stored value is not used before it is overwritten. To fix this we're enforcing a check on st_sensors_set_drdy_int_pin()'s return value and if it's an error, we're returning right away. Cc: jic23@kernel.org Cc: linux-iio@vger.kernel.org Signed-off-by: Lee Jones --- drivers/iio/common/st_sensors/st_sensors_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 8a4ec00..24cfe4e 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -306,8 +306,11 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, if (of_pdata) pdata = of_pdata; - if (pdata) + if (pdata) { err = st_sensors_set_drdy_int_pin(indio_dev, pdata); + if (err < 0) + return err; + } err = st_sensors_set_enable(indio_dev, false); if (err < 0)