From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3921FA28 for ; Sun, 13 Nov 2022 12:50:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75DA6C433D6; Sun, 13 Nov 2022 12:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668343850; bh=ZLs7zKpVQjz7HMM6k+kFXTlpaYFs0LUhExq4XQcd1s4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bRL9hllLDlw9+RuOxEp/BTtZqu0sxnMGpsShotQYUQBomE5dvFVoD1N24YGwz6V+E bls9ihBMe9GMjEry7sBd0YrrC6rli2crxqF6LGgLrP2JxooH2LV3J8Bw3VYvsrfs+W w05hHQ6W8XSvWUY5qtl9FMmxNWvaVq0KPH1abZ6krHZoEF/uWowqkzHh7neWwe1S5m 34TbGm40XsmFHKDxe+ppF8fgJ9eywuHPOBe8NTVUnLHre3t+AgUrS3t3tphhayQUul rZZZhKLrlX52Dr3j+Ch0cOJiZFcA6fekyRn6LnDIK9fHTqyyLtxou9VntemQz768m9 y85c6lNFSvivw== Date: Sun, 13 Nov 2022 13:03:06 +0000 From: Jonathan Cameron To: Deepak R Varma Cc: Lars-Peter Clausen , Michael Hennerich , Greg Kroah-Hartman , linux-iio@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] staging: iio: meter: replace ternary operator by if condition Message-ID: <20221113130306.517e7aa3@jic23-huawei> In-Reply-To: References: X-Mailer: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 13 Nov 2022 10:58:20 +0530 Deepak R Varma wrote: > Replace ternary operator by simple if based evaluation of the return > value. Issue identified using coccicheck. > > Signed-off-by: Deepak R Varma Applied to the togreg branch of iio.git and pushed out as testing to see if 0-day can find anything we missed. Thanks, Jonathan > --- > > Changes in v2: > 1. Use if based evaluation instead of using min macro > suggested by Joe Perches. > > > drivers/staging/iio/meter/ade7854-i2c.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c > index a9a06e8dda51..71b67dd3c8e9 100644 > --- a/drivers/staging/iio/meter/ade7854-i2c.c > +++ b/drivers/staging/iio/meter/ade7854-i2c.c > @@ -61,7 +61,10 @@ static int ade7854_i2c_write_reg(struct device *dev, > unlock: > mutex_unlock(&st->buf_lock); > > - return ret < 0 ? ret : 0; > + if (ret < 0) > + return ret; > + > + return 0; > } > > static int ade7854_i2c_read_reg(struct device *dev, > -- > 2.34.1 > > >