Received: by 2002:ac0:950e:0:0:0:0:0 with SMTP id f14csp594023imc; Sat, 16 Mar 2019 09:46:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqy87GjzPDcV4XXpTWzHM/t+PxS+NZwBRNLuCB0Y3j04jEfws5TNrJ8PhJHbs0CTy2WW46Qw X-Received: by 2002:a17:902:290b:: with SMTP id g11mr10549055plb.269.1552754777964; Sat, 16 Mar 2019 09:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552754777; cv=none; d=google.com; s=arc-20160816; b=Mo1FEilpyC84NAu3kF4knX+zE9KsNPr72E1j36gczMzIePq5Y0cFLTaV4Vdqb5xP2t WdBo1Du7oqzqmMNstMcF9hEMH1XIitd6b4fTut3ALWyDBaJn872w0e+LlvCrsAvf3KyY XUvizNhKkvRR2oL3HsLuFIZ9Qiz+uOrcJqBnwBTBhSUJsEkpX7FzQE65kWWp8fWxtMat 3waz7GT53ekc1X3AnYcv/YL3DKviVkv6XPp15dp2EKOtjtPhOBz4/QMqFVhHh3JaQkle O0+CsDp7a4uDCouUm9gSBi3KoIZ8oQTWXGQAMnPwq5MnZMYQsjqtEeDuTbRUbs5nDGkX 7h+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=PvC4+SVVOYTNaQ0dOtM9PB1+Q8uPmbCG4Smnw0Hut74=; b=OwDH+9rmHYQpvWpKGrtIJW09IChLzyh3Nc7/ToX39iEsxt058bBuH2clx3mRxmM+Lf ZDawSSsxBRrGhu6Ai8KgkamtMSixLxVjrHjLwqkawWE3prb+yZgvM8uJFETSPslkj9kx 8wHENWg773N4BrFAoPraZx4+r4b1quru3LzqV4utgYFZDDVpXTVyrujBqjCjBMLM0WYa PQnAfI4hWTN5zKEkQpgsy07VrXx7cQEaCZ77YvxfjhfbSgX31uSzUm+HUID41MF37Nwi gYxYqmaH7l9wBkAMJ+CBhFq8CjCJyS1KHsuEnKVR9PfINDifdNyZuI/jj5bl3dRjrRJN brAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iGqJTDrt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r34si1523842pgl.120.2019.03.16.09.46.01; Sat, 16 Mar 2019 09:46:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iGqJTDrt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726698AbfCPQpZ (ORCPT + 99 others); Sat, 16 Mar 2019 12:45:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:44270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726376AbfCPQpZ (ORCPT ); Sat, 16 Mar 2019 12:45:25 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 036282186A; Sat, 16 Mar 2019 16:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552754724; bh=m92Zy73jzDgaKdtgMUBcgb1kVDQabnZLHPfcdxWmulc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iGqJTDrt4QcyaW0m4zISyvem6a7VnhUloaa5k1GuSBnpEDK9irLveLbUuAPbJO22n 1ITkV7p/aDGw/p/3OyEpHmuNnkoC00PTtA9nxObGS05GYuDrqNt6lAy7Dy/90HfGfG dkCkmH0jJeGY7tVI+wNSlas4rQJ9KFM+dqTBuESk= Date: Sat, 16 Mar 2019 16:45:19 +0000 From: Jonathan Cameron To: Mircea Caprioru Cc: , , , , Subject: Re: [PATCH 2/2] staging: iio: adc: ad7192: Report error directly in ad7192_setup Message-ID: <20190316164519.5faf1238@archlinux> In-Reply-To: <20190315111425.14275-2-mircea.caprioru@analog.com> References: <20190315111425.14275-1-mircea.caprioru@analog.com> <20190315111425.14275-2-mircea.caprioru@analog.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 15 Mar 2019 13:14:25 +0200 Mircea Caprioru wrote: > This patch removes the goto out statement thus ensuring that an error is > report as soon as it occurs. This gives more information and improves > readability. No problem with the patch, but I'm not sure why it gives more information? Gone from printing an useless error message to printing none. I'll just drop that bit of the description in favour of code readability. Hope you don't mind! Jonathan > > Signed-off-by: Mircea Caprioru > --- > drivers/staging/iio/adc/ad7192.c | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c > index ebab75bdeed7..27f962b8c4ef 100644 > --- a/drivers/staging/iio/adc/ad7192.c > +++ b/drivers/staging/iio/adc/ad7192.c > @@ -236,13 +236,13 @@ static int ad7192_setup(struct ad7192_state *st, > /* reset the serial interface */ > ret = ad_sd_reset(&st->sd, 48); > if (ret < 0) > - goto out; > + return ret; > usleep_range(500, 1000); /* Wait for at least 500us */ > > /* write/read test for device presence */ > ret = ad_sd_read_reg(&st->sd, AD7192_REG_ID, 1, &id); > if (ret) > - goto out; > + return ret; > > id &= AD7192_ID_MASK; > > @@ -310,15 +310,15 @@ static int ad7192_setup(struct ad7192_state *st, > > ret = ad_sd_write_reg(&st->sd, AD7192_REG_MODE, 3, st->mode); > if (ret) > - goto out; > + return ret; > > ret = ad_sd_write_reg(&st->sd, AD7192_REG_CONF, 3, st->conf); > if (ret) > - goto out; > + return ret; > > ret = ad7192_calibrate_all(st); > if (ret) > - goto out; > + return ret; > > /* Populate available ADC input ranges */ > for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++) { > @@ -332,9 +332,6 @@ static int ad7192_setup(struct ad7192_state *st, > } > > return 0; > -out: > - dev_err(&st->sd.spi->dev, "setup failed\n"); > - return ret; > } > > static ssize_t