Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3030986ybe; Sun, 15 Sep 2019 06:08:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyX/AIlFzEKVrjAKCFctdOgWrZGw/nUtbne7m9W/tjSNtZ3/vrQ7OmSiVKIsTWm3mUGPrWO X-Received: by 2002:aa7:d9d2:: with SMTP id v18mr2443424eds.177.1568552924928; Sun, 15 Sep 2019 06:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568552924; cv=none; d=google.com; s=arc-20160816; b=cbDOrrPfLaJvo20Qf0cqAW6SammAJo2jcK6FiYik4wByS3dHM8u6PyLagEtJ+HfHeG kvgE/IKMkKt6jHmO6xUnPzsSflSxB5aZo7JrnsBy5pxMzYxKHfFI+kdCtA54tRXBFkSe kdzOIG58iAUsDgMGx2ITg23otxO9tkIjOux4fDNgNpRtGc4Z+8VJiUaqZUaBZMFcMrVC 5pSjvtMf+9R43e99JH5OT9KgTmMhVEhE5vi3dVfezPJNFM9Kk2YNaOtwb+1hMmHCMbTz MPnqKzCyrtp7qnFpo17Wh/CzATiwFhkYiJexA+i8qHgwUdO6Swi3Y/oEmQv6iC2wrrmC TQqw== 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=SqghLIiKLMM/fOYKlwY8CjiwoWRS31Iye8BL3qwKvGE=; b=mOzuolpXbKfz6x7Q2aIm3rBEYZIAwY1L7LNZSvf/F3riTqdsg69GRfqJiRdXcAC/hS LUrXRpwrtQ8PPQQrPx5AkbY+UNCF/oI9Zm9Y9cKtrQTt/MBFrZrecT0z3F1MFcplnXKx higNGOK7oy/dR4vX8onyMHUpA1WlZjmbbPURtYBW1k5TyBlH/xwaGLgnWxs+1pbenN7z uwmA6j067Vk65SIb2xn1C4sIn/h64GbbsIsRCbM2qSS5yjZAyYjIxldI3l7JiJHxwe4D xAeI4CHJeCU64Citw6du3fwUfrkr3DI2O+rPYOSVVjZbWWNJphxdlQq2BW6ZRLv9aOZz NVPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pUKG436F; 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 qn19si17514417ejb.355.2019.09.15.06.08.21; Sun, 15 Sep 2019 06:08:44 -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=pUKG436F; 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 S1730987AbfIOM6I (ORCPT + 99 others); Sun, 15 Sep 2019 08:58:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:34480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbfIOM6I (ORCPT ); Sun, 15 Sep 2019 08:58:08 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 CD33B21479; Sun, 15 Sep 2019 12:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568552287; bh=LSBxVcneOfUhNHi/n1dyGze982/VrrywLYPhfUHCG1c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pUKG436FQ5b5Cr84YnEmIU+IostRdypdKGW6RUxCZUcSYwcl7DR9Whd3kPTc4k7O6 k0Bpd0kNULNQVdV7sVJQPR2amnt45CAnajzEs8myKQXhfg2U+ru69DPWPu0Sgzz4/Y +SjBJyqFrzi03u3JMjkh2DOs8wdoDdLAiIgdHulY= Date: Sun, 15 Sep 2019 13:58:02 +0100 From: Jonathan Cameron To: Andreas Klinger Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] iio: adc: hx711: remove unnecessary returns Message-ID: <20190915135802.4051574e@archlinux> In-Reply-To: <20190909123806.ewrxc7y5gmh5plmk@arbad> References: <20190909123806.ewrxc7y5gmh5plmk@arbad> X-Mailer: Claws Mail 3.17.4 (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 Mon, 9 Sep 2019 14:38:08 +0200 Andreas Klinger wrote: > Optimize use of return in hx711_set_gain_for_channel(). > > Signed-off-by: Andreas Klinger I agree with Joe on this. Minor reduction in code, but hurts readability so a no on this one. thanks, Jonathan > --- > drivers/iio/adc/hx711.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c > index c8686558429b..20c249f502c0 100644 > --- a/drivers/iio/adc/hx711.c > +++ b/drivers/iio/adc/hx711.c > @@ -213,7 +213,7 @@ static int hx711_reset(struct hx711_data *hx711_data) > > static int hx711_set_gain_for_channel(struct hx711_data *hx711_data, int chan) > { > - int ret; > + int ret = 0; > > if (chan == 0) { > if (hx711_data->gain_set == 32) { > @@ -224,8 +224,6 @@ static int hx711_set_gain_for_channel(struct hx711_data *hx711_data, int chan) > return ret; > > ret = hx711_wait_for_ready(hx711_data); > - if (ret) > - return ret; > } > } else { > if (hx711_data->gain_set != 32) { > @@ -236,12 +234,10 @@ static int hx711_set_gain_for_channel(struct hx711_data *hx711_data, int chan) > return ret; > > ret = hx711_wait_for_ready(hx711_data); > - if (ret) > - return ret; > } > } > > - return 0; > + return ret; > } > > static int hx711_reset_read(struct hx711_data *hx711_data, int chan)