From patchwork Mon Sep 16 16:02:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 20360 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0D223248D3 for ; Mon, 16 Sep 2013 16:02:51 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id i13sf2167588qae.5 for ; Mon, 16 Sep 2013 09:02:50 -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: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=a12BsageMpPrArHZZPWIPCsVUVO4xmg6qCLdUhyvLjM=; b=Z4LZ5rh4NHRShMnNaJ+Qs3wcGGc1vrFr6L3qsifh9kcd7g58qYID/TlLrWoMwZl6mQ Fj9FlShygQrWtmPzOELuYani5Qqz5+WVd67PQtai3gx922qEvSVw6zeSr6k5GHTxDUBE 5o1r9DUSZIJNVKdMoafq0hcbg0gWpbu5WcynggOCDdXRzLF7lUeVoxmnV0XMuXit8esZ EirjKPMCBEOB1Mmet0eQGZErKNtdHVBtMkKArJYzTiuNn41B19wlFcXzvh4/g+3JF3JU lLcQ5+ZoTv6flnSMIc5fX63LOW/+VkS73WZ74MbSyCWh5d2ZpCfINVpE5akjMEJotA4x t6AA== X-Gm-Message-State: ALoCoQmqX1g8CDe70QingoYMmhqZL/UknlvRaxQlToiEhxeQbBB+wrfa4EeNGDXyqSs2hx+Ywm+W X-Received: by 10.236.198.197 with SMTP id v45mr10798923yhn.26.1379347370812; Mon, 16 Sep 2013 09:02:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.117.69 with SMTP id kc5ls2341871qeb.42.gmail; Mon, 16 Sep 2013 09:02:50 -0700 (PDT) X-Received: by 10.220.199.5 with SMTP id eq5mr27616982vcb.16.1379347370685; Mon, 16 Sep 2013 09:02:50 -0700 (PDT) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id r3si7263352ven.107.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 09:02:50 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.46 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.46; Received: by mail-vb0-f46.google.com with SMTP id p13so2940766vbe.19 for ; Mon, 16 Sep 2013 09:02:50 -0700 (PDT) X-Received: by 10.220.11.7 with SMTP id r7mr27739687vcr.12.1379347370612; Mon, 16 Sep 2013 09:02:50 -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 u4csp104940vcz; Mon, 16 Sep 2013 09:02:49 -0700 (PDT) X-Received: by 10.14.224.66 with SMTP id w42mr1444574eep.86.1379347369088; Mon, 16 Sep 2013 09:02:49 -0700 (PDT) Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) by mx.google.com with ESMTPS id e46si16800282eeo.222.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 09:02:49 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.48 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.83.48; Received: by mail-ee0-f48.google.com with SMTP id l10so2116255eei.21 for ; Mon, 16 Sep 2013 09:02:48 -0700 (PDT) X-Received: by 10.15.63.142 with SMTP id m14mr832504eex.106.1379347368478; Mon, 16 Sep 2013 09:02:48 -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 z12sm43061275eev.6.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 09:02:48 -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 12/20] iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor() Date: Mon, 16 Sep 2013 17:02:18 +0100 Message-Id: <1379347346-823-13-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1379347346-823-1-git-send-email-lee.jones@linaro.org> References: <1379347346-823-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.46 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: , Strip out all those unnecessary gotos and just return the error right away. Aids to simplicity and reduces code. Signed-off-by: Lee Jones --- drivers/iio/common/st_sensors/st_sensors_core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 2672630..c5fbe58 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -241,29 +241,28 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, err = st_sensors_set_enable(indio_dev, false); if (err < 0) - goto init_error; + return err; if (sdata->current_fullscale) { err = st_sensors_set_fullscale(indio_dev, sdata->current_fullscale->num); if (err < 0) - goto init_error; + return err; } else dev_info(&indio_dev->dev, "Full-scale not possible\n"); err = st_sensors_set_odr(indio_dev, sdata->odr); if (err < 0) - goto init_error; + return err; /* set BDU */ err = st_sensors_write_data_with_mask(indio_dev, sdata->sensor->bdu.addr, sdata->sensor->bdu.mask, true); if (err < 0) - goto init_error; + return err; err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS); -init_error: return err; } EXPORT_SYMBOL(st_sensors_init_sensor);