From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33908C43387 for ; Sun, 16 Dec 2018 12:38:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E515521839 for ; Sun, 16 Dec 2018 12:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544963891; bh=KhFLQsot0xO71kOD5sz/O03rvRcitoQeNHwTao0KAQM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=CVIE+UPLHRsNlyQ+AVB+MumOHHzyBX3NuoQADHrzV4+sc0YZsseR3f/JN12xLG9gn jDPRnbUNMgydk4lKDdTzQKMqI4bNgT2N1UdSlBYeM9g6mjs747tPvnQgXXi4BV1Il4 GThyVmWZLhdXeuW2LN2SwS/TPKO2AKb1C76F2JZI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730395AbeLPMiK (ORCPT ); Sun, 16 Dec 2018 07:38:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:50264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730269AbeLPMiK (ORCPT ); Sun, 16 Dec 2018 07:38:10 -0500 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 DAF77217F9; Sun, 16 Dec 2018 12:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544963889; bh=KhFLQsot0xO71kOD5sz/O03rvRcitoQeNHwTao0KAQM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=I6ty1m2zF+hM7qdwDlqv4keccpkH+J4s0ZjhFoX1N8c8zZpOLnbz/emMaZGF4lJEA h0XZiGis4DCnXXlFf2x/KGlk4c3YPnie9pmowi6FFrTisaw0MEpRrBpjXppg/ECsMz nLA7SVvVkJdLxMz53PGqG4PQmALzetT8qi3LjKiY= Date: Sun, 16 Dec 2018 12:38:04 +0000 From: Jonathan Cameron To: Hardik Singh Rathore Cc: Lars-Peter Clausen , Michael Hennerich , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: iio: ad7816: drop unnecessary initialization of variables Message-ID: <20181216123804.7d5ed60d@archlinux> In-Reply-To: <20181212175707.12513-1-hardiksingh.k@gmail.com> References: <20181212175707.12513-1-hardiksingh.k@gmail.com> X-Mailer: Claws Mail 3.17.2 (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-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Wed, 12 Dec 2018 23:27:07 +0530 Hardik Singh Rathore wrote: > Initialization is unnecessary when the variable is written before it is > read. There were some occasions in which the driver would initialize `ret' > during declaration without need. > > Signed-off-by: Hardik Singh Rathore Applied. Thanks, Jonathan > --- > drivers/staging/iio/adc/ad7816.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c > index 5209651a1b25..ee50e7296795 100644 > --- a/drivers/staging/iio/adc/ad7816.c > +++ b/drivers/staging/iio/adc/ad7816.c > @@ -65,7 +65,7 @@ enum ad7816_type { > static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data) > { > struct spi_device *spi_dev = chip->spi_dev; > - int ret = 0; > + int ret; > __be16 buf; > > gpiod_set_value(chip->rdwr_pin, 1); > @@ -106,7 +106,7 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data) > static int ad7816_spi_write(struct ad7816_chip_info *chip, u8 data) > { > struct spi_device *spi_dev = chip->spi_dev; > - int ret = 0; > + int ret; > > gpiod_set_value(chip->rdwr_pin, 1); > gpiod_set_value(chip->rdwr_pin, 0); > @@ -354,8 +354,7 @@ static int ad7816_probe(struct spi_device *spi_dev) > { > struct ad7816_chip_info *chip; > struct iio_dev *indio_dev; > - int ret = 0; > - int i; > + int i, ret; > > indio_dev = devm_iio_device_alloc(&spi_dev->dev, sizeof(*chip)); > if (!indio_dev)