From patchwork Wed Dec 12 17:57:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hardik Singh Rathore X-Patchwork-Id: 10726879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE39E91E for ; Wed, 12 Dec 2018 17:57:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B093E2B943 for ; Wed, 12 Dec 2018 17:57:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3FBF2B956; Wed, 12 Dec 2018 17:57:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 505EA2B943 for ; Wed, 12 Dec 2018 17:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727808AbeLLR5y (ORCPT ); Wed, 12 Dec 2018 12:57:54 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43605 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727748AbeLLR5y (ORCPT ); Wed, 12 Dec 2018 12:57:54 -0500 Received: by mail-pg1-f195.google.com with SMTP id v28so8664935pgk.10; Wed, 12 Dec 2018 09:57:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=DA8Mk5U48AtUQez3Hhs0oXRls5co3Oyr1gu2A2vPDgs=; b=ffXGJmtGvnqaxv3mWAg6/NR91TEUSuoA0a/pUJKDP3rQ3thRUK5+q+Et6y/kaAyIBW E+srMqam7uZ/QCEZhQ5TPw3WjSMIBlgD3wAsTRPS/Pl8+jpqFHIaj6Ss0cB4Rb3DCWTZ kbQjFqe5deOK3DR0OEf9yZhTyFxBowU8rlgGHFOOkDwMlJC1GSaLZJrRhhgcYgfQhdFz n1SVHoEzED/YwLgNkabQnitmXs0MrGyo/QYqGiT5gElsvKZbKzAsouqPX3ShrL/jYVN3 N2GYihrwrCOz1zVfHP8kkO8IGTIzD24aacmHyFdD+Pm4mVFGKzOZSOEyREQvcyxq779W 7bdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DA8Mk5U48AtUQez3Hhs0oXRls5co3Oyr1gu2A2vPDgs=; b=GwW3ie+IFmpYHvKxpcK25bS5B98+p0WBmqQHDrptjiaLUzojCgAb9lID/n0MPYyFEK ePigOyGRR01CCbYJ4Wle16OOH0/j6/7qvrHWwQZZZVoEMeyeXQAxmQT0wqMFiBFnsuIM h2McMwK6i6hrjrP/kWdc0n2eep0HguYHG966G4HqsN7hDCGQ50r+02cD2Lx1D4p0WJIE iML54KGbeJ2NtkYcphqB2+iSL1EXZdnVFuwdxa0BE0hkiaEsasTWmFsh35u7Bgrdr3m5 RK5ZODlDL2ZVBpED/aFqOnAOMv/ajSk4PNmm7WZTCP9XBjaX6a8DIN2vT0IoJPwrPqi7 wjug== X-Gm-Message-State: AA+aEWaXV+f9PmLZQS/zNHYR39UAQX00NxADdXJx0qMGekOmfC5FiOn4 sbv1SjwGYaQygjijMwVZAU8= X-Google-Smtp-Source: AFSGD/XJn0Nw93/PqLyrXJ+J6+zPKMm53rhsfKn9AXuJFGBKtCvzYTyqY6qP8pQ8PLjJ/bUr984LvA== X-Received: by 2002:a63:40c6:: with SMTP id n189mr18671707pga.355.1544637472955; Wed, 12 Dec 2018 09:57:52 -0800 (PST) Received: from localhost.localdomain ([27.59.69.235]) by smtp.googlemail.com with ESMTPSA id w136sm26430922pfd.169.2018.12.12.09.57.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 09:57:52 -0800 (PST) From: Hardik Singh Rathore To: jic23@kernel.org Cc: Hardik Singh Rathore , 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: [PATCH] staging: iio: ad7816: drop unnecessary initialization of variables Date: Wed, 12 Dec 2018 23:27:07 +0530 Message-Id: <20181212175707.12513-1-hardiksingh.k@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)