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: 36193 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f70.google.com (mail-qg0-f70.google.com [209.85.192.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CB7522054F for ; Thu, 28 Aug 2014 13:14:32 +0000 (UTC) Received: by mail-qg0-f70.google.com with SMTP id i50sf4490747qgf.5 for ; Thu, 28 Aug 2014 06:14:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=bKsdiqUjmwinvGwalxYLmp91QMQX5B3eCAHd9NniANI=; b=iqqwJYdHcFUCj/y+U5KUAQWJHVIR7iHP+mzMgxIlk3dHJvipfoDU2NFqEenJ4lr+Ui LTs0FHkNilkmj2MkHiPN00pbM8etyMod1j9hIM8JMJIsnl4fkwOXyeG3S4btn0BAIxVk XgG1FPUn7mT7NlSuDlj4xGJZ+ce1v/e2PxIQhj+GRWlVmqAfS09S2qGZsjAqDZNaf2+M I1YjTGc7Fu3fENY1GH1/3MODUteRNz1SczVqCqjuX1Aow4yfJuFtNkejtiFKPfsi5WkG eb/wmDnqiUGYVBrCMaP8g4tny7OIrnA4eTU/IWANf+U+u3mfZTlOxMxr6JFUiQbLUSzs sjGA== X-Gm-Message-State: ALoCoQn8o59rVwDhgbCToFeYyw6inGtY9mD9Ya1QTGw/zjiLVOBJnZUWHfQyF89xCgf3FHi1dzyP X-Received: by 10.236.63.197 with SMTP id a45mr193442yhd.9.1409231672683; Thu, 28 Aug 2014 06:14:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.229 with SMTP id 92ls381419qgn.98.gmail; Thu, 28 Aug 2014 06:14:32 -0700 (PDT) X-Received: by 10.220.81.132 with SMTP id x4mr3064864vck.0.1409231672591; Thu, 28 Aug 2014 06:14:32 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id n3si3328388vcj.92.2014.08.28.06.14.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 06:14:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id ij19so758356vcb.17 for ; Thu, 28 Aug 2014 06:14:32 -0700 (PDT) X-Received: by 10.220.81.132 with SMTP id x4mr3064856vck.0.1409231672521; Thu, 28 Aug 2014 06:14:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp234618vcb; Thu, 28 Aug 2014 06:14:32 -0700 (PDT) X-Received: by 10.50.6.77 with SMTP id y13mr5135402igy.21.1409231671960; Thu, 28 Aug 2014 06:14:31 -0700 (PDT) Received: from mail-ig0-f170.google.com (mail-ig0-f170.google.com [209.85.213.170]) by mx.google.com with ESMTPS id w2si9229298igl.29.2014.08.28.06.14.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 06:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of lee.jones@linaro.org designates 209.85.213.170 as permitted sender) client-ip=209.85.213.170; Received: by mail-ig0-f170.google.com with SMTP id h3so497618igd.3 for ; Thu, 28 Aug 2014 06:14:31 -0700 (PDT) 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 Cc: Lee Jones , jic23@kernel.org, linux-iio@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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)