From patchwork Wed Mar 20 18:03:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10862369 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 22F1813B5 for ; Wed, 20 Mar 2019 18:07:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0085229E37 for ; Wed, 20 Mar 2019 18:07:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E914229E4A; Wed, 20 Mar 2019 18:07:08 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 981A129E37 for ; Wed, 20 Mar 2019 18:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=tOBeAKzel6MV/OCbCm802J81psC3B3s0pQaUA7KmLe0=; b=Q7S+ouiwumyTGH m3Ff7QhGtp+XGBIF80PcTRJsU3e8bFKMVuwy3Q+9h4NSARZCnRiEaf5ib2SeHsuaDivMm++zSC70D wJ94ECH6SNLRKzu/E1ZE3HPx7FjQLk2Wf1gL+Hi0C0fRBFpbq8CsrxjUMDKAuigs9BulQAkVOMRU0 V1OfLwUtYocS8pGRwnlfiL6ssGMyqPV4OFY3FWVwbRi7b3cXKlzW5p3n6A/2qm3zLVj574drxNjya oVERd6dRiJmZCiRBvbAgLC5YgK9qjVA7/jM81avmHqUcgbnRGP2jlSeMA4Ky/tzyGNkq2rOFSlmyg krT7F3ix5QbU9SAhfq6A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6fc8-0005UZ-Tu; Wed, 20 Mar 2019 18:06:56 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6fc0-0005MM-IX; Wed, 20 Mar 2019 18:06:50 +0000 Received: by mail-ed1-x544.google.com with SMTP id a16so2824890edn.1; Wed, 20 Mar 2019 11:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ie/gO33ummQZ9638dodi7nVWJf2BdsHZwgBEndrbI2g=; b=Rg0Hyeg+v4P3KDeVUWR9x1ENh4cN9DLVjpEJmzuJ4Be3QZu9Vj2XSyqd7L1zCBdrF8 YuqDg9kFDWEPJU19OSgS8NB5Ucn/lLEw0qahth5hpcs97IEmkTC1w//y5GCQPe+qVvPi 7jeZcfOO3F+RV6Ee0f84/FovCxdbDV3GbQKIftf0prcUgLDf/nI/UX6ZIF16QeciO90D jC4tUd9SnZMPd+ZGSwU/UQAHLi9azeXBVKcvThNsElvS+C+W7Bx0tLcz/m94Q05rbKsX duy6onivQcfyNp7PvgTzJtm1oxe82myCF1pcYNDx17L0mtI5IsooYMKBJs/BaPZEK7lU Ip6Q== 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=ie/gO33ummQZ9638dodi7nVWJf2BdsHZwgBEndrbI2g=; b=H1riMVS9RddoPZfzmMbIMtxdeGarrXicwDQAfvO4GHne5a/RKEA7t3xqg+NqKN02Xr wB07OU/hYYH+JV1NwCI9BH/aXJrMGMhdjkL+V4xaV/NbN0fuVHCbFhWQYYFaUkkqDo8V yssgMKdwfzXG4cXrRyKGcIlK4HaeRHdC87hddcxqeT7mpdH2v+gJxDmYojTsAewitVJa FQYENqc2AKj+/OussiRGDZtiLBGuPhn0bt9jdQajtScd1kWD9z3TjsIZycsEeTwDDid1 1muCtQQxugVda/L8LJmTkYKPmfNoJmrC3cL5fNYEn2JRRKaI+zv+eQYkhrxFLIXSg7CL 0m4Q== X-Gm-Message-State: APjAAAWTgtddmWNRKv04ClQqbvryCKER1021IWg//5kBqy4LtUW5VL3T JDxhbSAAEG54Z4EBBpZoZsE= X-Google-Smtp-Source: APXvYqzGIvKMAv6dC9dmfcKFY3a3fP1SjMU+t+sa/mE4H6tu88/HIv297uk+s5jYNNE2HQ0u+5Tv2Q== X-Received: by 2002:a05:6402:3cd:: with SMTP id t13mr21467312edw.281.1553105206072; Wed, 20 Mar 2019 11:06:46 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f9:2a:1fae::2]) by smtp.gmail.com with ESMTPSA id t17sm549148ejb.24.2019.03.20.11.06.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 11:06:44 -0700 (PDT) From: Nathan Chancellor To: "James E.J. Bottomley" , "Martin K. Petersen" Subject: [PATCH] scsi: ufs-mediatek: Avoid using ret uninitialized in ufs_mtk_setup_clocks Date: Wed, 20 Mar 2019 11:03:40 -0700 Message-Id: <20190320180340.25795-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190320_110648_640503_3BAEEDF0 X-CRM114-Status: GOOD ( 10.90 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-scsi@vger.kernel.org, clang-built-linux@googlegroups.com, Nick Desaulniers , linux-kernel@vger.kernel.org, Avri Altman , linux-mediatek@lists.infradead.org, Alim Akhtar , Matthias Brugger , Nathan Chancellor , Stanley Chu , Pedro Sousa , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When building with -Wsometimes-uninitialized, Clang warns: drivers/scsi/ufs/ufs-mediatek.c:112:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (on) ^~ drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs here return ret; ^~~ drivers/scsi/ufs/ufs-mediatek.c:112:3: note: remove the 'if' if its condition is always true if (on) ^~~~~~~ drivers/scsi/ufs/ufs-mediatek.c:108:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (!on) ^~~ drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs here return ret; ^~~ drivers/scsi/ufs/ufs-mediatek.c:108:3: note: remove the 'if' if its condition is always true if (!on) ^~~~~~~~ drivers/scsi/ufs/ufs-mediatek.c:96:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 2 warnings generated. Remove the default case and initialize ret to -EINVAL to properly fix this warning. Fixes: ddd90623ce26 ("scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips") Link: https://github.com/ClangBuiltLinux/linux/issues/426 Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Reviewed-by: Stanley Chu --- drivers/scsi/ufs/ufs-mediatek.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index c3b78fc83d3f..34aecad04468 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -93,7 +93,7 @@ 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; + int ret = -EINVAL; /* * In case ufs_mtk_init() is not yet done, simply ignore. @@ -112,9 +112,6 @@ static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on, if (on) ret = phy_power_on(host->mphy); break; - default: - ret = -EINVAL; - break; } return ret;