From patchwork Tue Sep 10 12:49:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 19877 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f198.google.com (mail-ye0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B7811246A4 for ; Tue, 10 Sep 2013 12:50:13 +0000 (UTC) Received: by mail-ye0-f198.google.com with SMTP id m11sf8278360yen.1 for ; Tue, 10 Sep 2013 05:50:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=kiP1/DupmD7ZLoTw6ZnVorae05c6q1x8FQroIG8hGX8=; b=GlcIPxbPVOLrZn7nG0OSTHOPpbLozIsu60VCStCXIqoFHXNzkAF0czZktcmIgLWq09 8yxIevp/X6cZKhrPaMUd0PCaZpAczzNmbUI3zAgHAIyeYyHrEQW0oTaUASahGrlUwi0c B7nG99/4ZW7zHw/IWj6hFTWyqLgIJ8JQIs/h6KSZGaM44/2WVOuGke7ndDrV9B9kMRVa kreyXxsun934BPc89E09/9xzvhuC+HOgyNC/z2aVp1vWHZDLyEcy6AHtSFHpzs5wOm1D v+ltwAWhyXI5AyItq6urHQASPcM7IjOXlm2yLl5KZEIpyvvMl6H1L/P7h9NP2s6BfKsU E8hQ== X-Received: by 10.236.24.195 with SMTP id x43mr8287722yhx.3.1378817413513; Tue, 10 Sep 2013 05:50:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.110.9 with SMTP id hw9ls2183002qeb.16.gmail; Tue, 10 Sep 2013 05:50:13 -0700 (PDT) X-Received: by 10.220.181.136 with SMTP id by8mr23292682vcb.11.1378817413286; Tue, 10 Sep 2013 05:50:13 -0700 (PDT) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by mx.google.com with ESMTPS id b5si4389634vcf.129.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:50:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.51; Received: by mail-vb0-f51.google.com with SMTP id x16so4831748vbf.38 for ; Tue, 10 Sep 2013 05:50:13 -0700 (PDT) X-Gm-Message-State: ALoCoQltdpRaIpVofGgeQgsttqa0dRqHug+VVbnhoB4NQJLCSuqDuvvPglcL+g92mrlOskfPWyPJ X-Received: by 10.58.133.66 with SMTP id pa2mr10945135veb.18.1378817413183; Tue, 10 Sep 2013 05:50:13 -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.220.174.196 with SMTP id u4csp19402vcz; Tue, 10 Sep 2013 05:50:12 -0700 (PDT) X-Received: by 10.14.172.133 with SMTP id t5mr38468186eel.35.1378817409735; Tue, 10 Sep 2013 05:50:09 -0700 (PDT) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx.google.com with ESMTPS id p9si14823005eeu.234.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:50:09 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.54 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.83.54; Received: by mail-ee0-f54.google.com with SMTP id e53so3811803eek.41 for ; Tue, 10 Sep 2013 05:50:09 -0700 (PDT) X-Received: by 10.14.10.2 with SMTP id 2mr3021358eeu.63.1378817409037; Tue, 10 Sep 2013 05:50:09 -0700 (PDT) Received: from localhost.localdomain (cpc15-aztw25-2-0-cust493.aztw.cable.virginmedia.com. [92.233.57.238]) by mx.google.com with ESMTPSA id z12sm31123277eev.6.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:50:08 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jic23@cam.ac.uk Cc: arnd@arndb.de, linus.walleij@linaro.org, denis.ciocca@st.com, linux-iio@vger.kernel.org, Lee Jones Subject: [PATCH 22/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_info_raw() Date: Tue, 10 Sep 2013 13:49:23 +0100 Message-Id: <1378817379-8238-23-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1378817379-8238-1-git-send-email-lee.jones@linaro.org> References: <1378817379-8238-1-git-send-email-lee.jones@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , Saving a few lines of code. Signed-off-by: Lee Jones --- drivers/iio/common/st_sensors/st_sensors_core.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 148f0e5..25d4c7e 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -359,28 +359,25 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev, mutex_lock(&indio_dev->mlock); if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) { err = -EBUSY; - goto read_error; + goto out; } else { err = st_sensors_set_enable(indio_dev, true); if (err < 0) - goto read_error; + goto out; msleep((sdata->sensor->bootime * 1000) / sdata->odr); err = st_sensors_read_axis_data(indio_dev, ch, val); if (err < 0) - goto read_error; + goto out; *val = *val >> ch->scan_type.shift; err = st_sensors_set_enable(indio_dev, false); } +out: mutex_unlock(&indio_dev->mlock); return err; - -read_error: - mutex_unlock(&indio_dev->mlock); - return err; } EXPORT_SYMBOL(st_sensors_read_info_raw);