From patchwork Mon Sep 16 16:02:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 20361 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CE952277F1 for ; Mon, 16 Sep 2013 16:02:51 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id c14sf4589945vea.1 for ; Mon, 16 Sep 2013 09:02:51 -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=Iu3K7vapXOi4Prg05ZwJ/nNtLpEm6MeLDl8oCIBzaE8=; b=Gft0bGZVqyYuZAT1KZ6qIEz2d+2cbWIyTwU7YfITB1pbbIN4+4m9hvWrPIzSzMqsgD gZ27bWIAADdt6A5PrddA8yLoXONfzwG91sVNryZsK7CVJo8g0amPR/tEPHSduBDgg35+ GpkuXvyC4Bv0jZR31Vx7TcElRZbLlVozo1gOngd2C1bTJd5WXI70pUkKRgxnlLJhIeAj ppk5tCGk8lHERd/nnxQNsGgw17SNtBEYLqTSOvVovgTqAYkeDzoKllVF2dJEbqjojubR zYQFcRMtPrwddtzbllN9fZw2Smg6a/L/2b8narq0YRH2PiuY+ZtvUpl24ZTrOD4kSu8m 17Tg== X-Gm-Message-State: ALoCoQkCB8BvlaBoZIwkSbH9VMzM0OHM21Wdii5P9+sLc6AIFgNHRGKZBYRaP4u2kUamP41MIks2 X-Received: by 10.224.5.5 with SMTP id 5mr63148qat.4.1379347371605; Mon, 16 Sep 2013 09:02:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.28.10 with SMTP id x10ls2436468qeg.20.gmail; Mon, 16 Sep 2013 09:02:51 -0700 (PDT) X-Received: by 10.220.249.67 with SMTP id mj3mr2073695vcb.23.1379347371488; Mon, 16 Sep 2013 09:02:51 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id m10si7268836veh.82.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 09:02:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.178 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.178; Received: by mail-ve0-f178.google.com with SMTP id jw12so3113892veb.37 for ; Mon, 16 Sep 2013 09:02:51 -0700 (PDT) X-Received: by 10.221.44.136 with SMTP id ug8mr27573420vcb.13.1379347371412; Mon, 16 Sep 2013 09:02:51 -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 u4csp104942vcz; Mon, 16 Sep 2013 09:02:50 -0700 (PDT) X-Received: by 10.14.224.198 with SMTP id x46mr4002295eep.53.1379347370057; Mon, 16 Sep 2013 09:02:50 -0700 (PDT) Received: from mail-ee0-f41.google.com (mail-ee0-f41.google.com [74.125.83.41]) by mx.google.com with ESMTPS id x49si16382124een.234.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: 74.125.83.41 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.83.41; Received: by mail-ee0-f41.google.com with SMTP id d17so2136058eek.14 for ; Mon, 16 Sep 2013 09:02:49 -0700 (PDT) X-Received: by 10.14.9.72 with SMTP id 48mr5414649ees.42.1379347369506; Mon, 16 Sep 2013 09:02:49 -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:49 -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 13/20] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data() Date: Mon, 16 Sep 2013 17:02:19 +0100 Message-Id: <1379347346-823-14-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.128.178 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: , Gets rid of those unnecessary gotos. Signed-off-by: Lee Jones --- drivers/iio/common/st_sensors/st_sensors_core.c | 8 +++----- 1 file changed, 3 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 c5fbe58..76e573b 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -331,10 +331,8 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev, unsigned int byte_for_channel = ch->scan_type.storagebits >> 3; outdata = kmalloc(byte_for_channel, GFP_KERNEL); - if (!outdata) { - err = -EINVAL; - goto st_sensors_read_axis_data_error; - } + if (!outdata) + return -ENOMEM; err = sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev, ch->address, byte_for_channel, @@ -349,7 +347,7 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev, st_sensors_free_memory: kfree(outdata); -st_sensors_read_axis_data_error: + return err; }