From patchwork Thu Mar 21 13:19:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 10863503 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 7C5BF1708 for ; Thu, 21 Mar 2019 13:19:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E6A1288C6 for ; Thu, 21 Mar 2019 13:19:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52A5528C0C; Thu, 21 Mar 2019 13:19:33 +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,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 E758C28DCE for ; Thu, 21 Mar 2019 13:19:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728297AbfCUNTc (ORCPT ); Thu, 21 Mar 2019 09:19:32 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:39170 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728032AbfCUNTc (ORCPT ); Thu, 21 Mar 2019 09:19:32 -0400 Received: by mail-lj1-f195.google.com with SMTP id l7so5271022ljg.6 for ; Thu, 21 Mar 2019 06:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9vEE+IWH1UQ/MYCPFbtRTwD8BWeX2JpFTXYc7Ro5vRA=; b=eqt07IO2L+GP5NlWtP6wSmasOxMFMm6uR9nrBOshubebkmUQJxXFY2AOn7j8Q5z47f WjiRwX6XPBzhPrf7NJnjmC4TLiFg1X3tz8gObiG/6xHvWu0UjA9KdvMY/CnS1/5oSyB1 cXsV4Xdgx7HMN3A2JcOhNwfBhQTAn2SY6n9TJrMi0g1swSoxjwIUwZo3OWyb1VN9Qza4 zTNt/ByTGPSifxMDwZNb+30+py3F3OyJZfcUQz0FPgIKe+qZymYwlqVImwKvnH0WiOun S1mLNyNxc2bNxc5YZG/s//EmqFebCuUOTn55wDxE8WJjKjaX7EMmVr1YuPPp2p3CZLvj CQZA== 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:mime-version :content-transfer-encoding; bh=9vEE+IWH1UQ/MYCPFbtRTwD8BWeX2JpFTXYc7Ro5vRA=; b=DvqkUEStBCTBRxBhXBiYlsnMbdwJ8YPYAzqKp3vFJqVh7oog7QNHIUL+1Ys7npjiAI FgmgJbp3ViVT/Z+aWt78CD/AwfVKMxbdSRCsKbK/r4p7gy+k2xNtkZZ81AeGPjH8RS67 FEreEp/U4OkAcC23hJo7ScH53TTt84IL8ad6jJhDMG9LA5q54lzHmN4ToPTPMqtCze1D P/iQmjYKEIFgNqMx8hSGMg2cXjNJWRBFGCCuBnYv/1EOvi22r9lZjUxUYJ1XqLgonJ0b 0kXJyvuS9lPikbBs+q6yG6kpa5dzqqLKIPiJgm8vyFyG6ypSV1DqyuzxC4dupW04kSS0 OILA== X-Gm-Message-State: APjAAAVhymSv4mzbyaONPfqQHHbiANRy4MH/sgxnTAKIFrVbyhJP0PIb PKuI8Gf3PtvDiZL0UDdQtA83Lg== X-Google-Smtp-Source: APXvYqxlhvHaT9akV8SGIwO9h7EwW9p75tBnryeDP9GZ3dd3qD480c5vKuE0KNx5SQBBATXMYE1/ew== X-Received: by 2002:a2e:97d3:: with SMTP id m19mr2020201ljj.63.1553174370161; Thu, 21 Mar 2019 06:19:30 -0700 (PDT) Received: from localhost (c-573670d5.07-21-73746f28.bbcust.telenor.se. [213.112.54.87]) by smtp.gmail.com with ESMTPSA id i66sm840726lji.43.2019.03.21.06.19.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Mar 2019 06:19:29 -0700 (PDT) From: Anders Roxell To: jejb@linux.ibm.com, martin.petersen@oracle.com, matthias.bgg@gmail.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Anders Roxell Subject: [PATCH] scsi: ufs-mediatek: fix uninitialized variable Date: Thu, 21 Mar 2019 14:19:25 +0100 Message-Id: <20190321131925.27421-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When building the ufs-mediatek driver variable 'ret' may be used uninitialized. ../drivers/scsi/ufs/ufs-mediatek.c: In function ‘ufs_mtk_setup_clocks’: ../drivers/scsi/ufs/ufs-mediatek.c:96:6: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized] int ret; ^~~ Rework to return directly instead of using a local variable 'ret'. Fixes: ddd90623ce26 ("scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips") Signed-off-by: Anders Roxell --- drivers/scsi/ufs/ufs-mediatek.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index ce4767784937..330d68871b06 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -93,7 +93,6 @@ static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on, enum ufs_notify_change_status status) { struct ufs_mtk_host *host = ufshcd_get_variant(hba); - int ret; /* * In case ufs_mtk_init() is not yet done, simply ignore. @@ -106,18 +105,18 @@ static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on, switch (status) { case PRE_CHANGE: if (!on) - ret = phy_power_off(host->mphy); + return phy_power_off(host->mphy); break; case POST_CHANGE: if (on) - ret = phy_power_on(host->mphy); + return phy_power_on(host->mphy); break; default: - ret = -EINVAL; + return -EINVAL; break; } - return ret; + return 0; } /**