Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp668145img; Thu, 21 Mar 2019 06:35:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPe4+nK8CZQuUYuJlhz6XyY2P51KIctWrYdtK/1dPCpepUFNjUebnFKCRSyAfPNj1hF32m X-Received: by 2002:a17:902:b70c:: with SMTP id d12mr3664798pls.88.1553175324403; Thu, 21 Mar 2019 06:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553175324; cv=none; d=google.com; s=arc-20160816; b=1FTQRCATipbxyW/IBLIbpvtk/Lt/BeWPkM4iFOLEizmIYR1MepmcorHGK5lwcGV/uJ oBG1zhC2LOOS6Y+v3C2zRcMtZKJBHcatItdWutcazTv8sLrCmSLT62u9wr7oY2WMZ9tv rrpewOc6yNtl8fps5aqKB+PMAh+4QjgBKxaELgj86Ctgj5pisRkHCEb9Hqhma2mHiFXO 58OxaadQar9rmlujPH95yKqYSDnsxizHukjf56EncIewMasQNtMV24dU7feMQxYjAxoP k/3kfICQlWLt6aBTHY+fXjNO+zb1DEjk+HPujnvJGd3hf6McLpbmQTbe6TPt9Jm7qrvM cdyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=0aI9a9MoxeKIE1Ij9cY9Svrcf5z5AButT1adKHWA8hk=; b=SuoHMeddvQ2uyct8sVgmiFT1OCJXV495dzk0ud1JHAobSRKxyJ1AUODhxn1h/JP0Fo SIf78M8mwOIgWGnKiCGEjmGcAMRSOp546GV8FPQv4Szaw6KLkacJ3ZEKYV07NQu+FodQ 9z6wCcrOFpxz52V50w+06wdNU4VoNXbnTmZcCVLGbKl/R9+6+Ob4j8ZOJ3Bihwf76roT 89MwyMOhl3OUwQrXrKjrV0wo9CiejNSox8hW58r0KEP14Oe0IP2xc11ZGIOipFAZGyGF OoEtHQVoV2j18Chz9ldVqoE+L3K4Cjf4z4TGe+XcjNlBqTbPFp3zKvD4djAtO770nEir wHEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n23si4344027plp.182.2019.03.21.06.35.09; Thu, 21 Mar 2019 06:35:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728325AbfCUNeY (ORCPT + 99 others); Thu, 21 Mar 2019 09:34:24 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:55121 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727857AbfCUNeX (ORCPT ); Thu, 21 Mar 2019 09:34:23 -0400 X-UUID: a5a4a611dc144ef8ab62805dde40f35d-20190321 X-UUID: a5a4a611dc144ef8ab62805dde40f35d-20190321 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1182047461; Thu, 21 Mar 2019 21:34:16 +0800 Received: from MTKMBS01DR.mediatek.inc (172.21.101.111) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 21 Mar 2019 21:34:15 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01dr.mediatek.inc (172.21.101.111) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 21 Mar 2019 21:34:14 +0800 Received: from [172.21.77.33] (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 21 Mar 2019 21:34:14 +0800 Message-ID: <1553175254.30977.88.camel@mtkswgap22> Subject: Re: [PATCH] scsi: ufs-mediatek: fix uninitialized variable From: Stanley Chu To: Anders Roxell CC: , , , , , , Date: Thu, 21 Mar 2019 21:34:14 +0800 In-Reply-To: <20190321131925.27421-1-anders.roxell@linaro.org> References: <20190321131925.27421-1-anders.roxell@linaro.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anders, On Thu, 2019-03-21 at 14:19 +0100, Anders Roxell wrote: > 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; > } > > /** This was already fixed by Nathan Chancellor in below patch, https://lkml.org/lkml/2019/3/20/784 Anyway thanks for sending this fix. Stanley.