From patchwork Wed Sep 4 09:31:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 19744 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f200.google.com (mail-ye0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 98A8424869 for ; Wed, 4 Sep 2013 09:32:01 +0000 (UTC) Received: by mail-ye0-f200.google.com with SMTP id r3sf48153yen.3 for ; Wed, 04 Sep 2013 02:32:01 -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=xsjCfUvxKUyhRQQ1Aymq6wfdk4kv/0z1+ZBhrF70h5U=; b=FX1pohk2alHbxOH4jDF1noMp3AOaIxZmw1AoQjTmrstJ6safOZYgFQK2DNli+nHNks rQXj5m7AmEoZ4tW9Gf0lo99yH6MUPSn2vJQi/2qktJ0SM6w/sw4+2L+3rxmwMU3Bu+q5 VJWtYKCTD7SSOajUo9RDya3N/E22iSa/81/7KO7+HJYhWh1IY7zNsTGfVGNY7p8+rlWR AxSPEXL6kQ6tB1T7JDPDnUTDelH9lKI6QclRVz4WZ7TAhLdajY4rHABYSynzFMHI7a0y bt21R2MBFRAF1B1r54DO+2N5igooffTEgKG1tkNgovvsiHcILAD8AYzrNvh8voAbAyWP TMug== X-Received: by 10.236.207.103 with SMTP id m67mr725003yho.1.1378287121431; Wed, 04 Sep 2013 02:32:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.16.200 with SMTP id i8ls60786qed.65.gmail; Wed, 04 Sep 2013 02:32:01 -0700 (PDT) X-Received: by 10.52.103.35 with SMTP id ft3mr1548168vdb.5.1378287121026; Wed, 04 Sep 2013 02:32:01 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id wp10si5196334vdb.32.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 02:32:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id 15so40887vea.29 for ; Wed, 04 Sep 2013 02:32:00 -0700 (PDT) X-Gm-Message-State: ALoCoQn25JeSWtyhAKPoSwwPrsR+Yjgdi20kml/gF4CtWENITrYwahLeNPJg8BODwOotnS7yqLxf X-Received: by 10.220.91.16 with SMTP id k16mr1823562vcm.21.1378287120937; Wed, 04 Sep 2013 02:32:00 -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 u4csp223876vcz; Wed, 4 Sep 2013 02:32:00 -0700 (PDT) X-Received: by 10.14.172.133 with SMTP id t5mr2510850eel.35.1378287119979; Wed, 04 Sep 2013 02:31:59 -0700 (PDT) Received: from mail-ea0-f176.google.com (mail-ea0-f176.google.com [209.85.215.176]) by mx.google.com with ESMTPS id 7si18313252eeo.319.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 02:31:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.176 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.215.176; Received: by mail-ea0-f176.google.com with SMTP id q16so35340ead.7 for ; Wed, 04 Sep 2013 02:31:59 -0700 (PDT) X-Received: by 10.14.224.198 with SMTP id x46mr2130652eep.53.1378287119317; Wed, 04 Sep 2013 02:31:59 -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 p5sm38475700eeg.5.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 02:31:58 -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 04/11] iio: pressure-i2c: st: Simplify error checking in probe() Date: Wed, 4 Sep 2013 10:31:36 +0100 Message-Id: <1378287103-21765-5-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1378287103-21765-1-git-send-email-lee.jones@linaro.org> References: <1378287103-21765-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.128.170 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 the unnecessary gotos and check for NULL returns in the usual manner. Signed-off-by: Lee Jones --- drivers/iio/pressure/st_pressure_i2c.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c index 7cebcc7..2ace770 100644 --- a/drivers/iio/pressure/st_pressure_i2c.c +++ b/drivers/iio/pressure/st_pressure_i2c.c @@ -26,10 +26,8 @@ static int st_press_i2c_probe(struct i2c_client *client, int err; indio_dev = iio_device_alloc(sizeof(*pdata)); - if (indio_dev == NULL) { - err = -ENOMEM; - goto iio_device_alloc_error; - } + if (!indio_dev) + return -ENOMEM; pdata = iio_priv(indio_dev); pdata->dev = &client->dev; @@ -37,15 +35,12 @@ static int st_press_i2c_probe(struct i2c_client *client, st_sensors_i2c_configure(indio_dev, client, pdata); err = st_press_common_probe(indio_dev); - if (err < 0) - goto st_press_common_probe_error; + if (err < 0) { + iio_device_free(indio_dev); + return err; + } return 0; - -st_press_common_probe_error: - iio_device_free(indio_dev); -iio_device_alloc_error: - return err; } static int st_press_i2c_remove(struct i2c_client *client)