Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: uninitialized variable in ufshcd_devfreq_target()
@ 2024-02-13 18:08 Dan Carpenter
  2024-02-15  5:53 ` Peter Wang (王信友)
  2024-02-15 18:22 ` Bart Van Assche
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-02-13 18:08 UTC (permalink / raw)
  To: Peter Wang
  Cc: Alim Akhtar, Avri Altman, Bart Van Assche, James E.J. Bottomley,
	Martin K. Petersen, Stanley Chu, Can Guo, Bao D. Nguyen,
	Manivannan Sadhasivam, Bean Huo, Ziqi Chen, Adrien Thierry,
	linux-scsi, linux-kernel, kernel-janitors

There is one goto where "sched_clk_scaling_suspend_work" is true but
"scale_up" is uninitialized.  It leads to a Smatch uninitialized variable
warning:

drivers/ufs/core/ufshcd.c:1589 ufshcd_devfreq_target() error: uninitialized symbol 'scale_up'.

Fixes: 1d969731b87f ("scsi: ufs: core: Only suspend clock scaling if scaling down")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index d10a77d05d2f..a8a9edb7ba24 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -1514,7 +1514,7 @@ static int ufshcd_devfreq_target(struct device *dev,
 	int ret = 0;
 	struct ufs_hba *hba = dev_get_drvdata(dev);
 	ktime_t start;
-	bool scale_up, sched_clk_scaling_suspend_work = false;
+	bool scale_up = false, sched_clk_scaling_suspend_work = false;
 	struct list_head *clk_list = &hba->clk_list_head;
 	struct ufs_clk_info *clki;
 	unsigned long irq_flags;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: ufs: uninitialized variable in ufshcd_devfreq_target()
  2024-02-13 18:08 [PATCH] scsi: ufs: uninitialized variable in ufshcd_devfreq_target() Dan Carpenter
@ 2024-02-15  5:53 ` Peter Wang (王信友)
  2024-02-15 18:22 ` Bart Van Assche
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Wang (王信友) @ 2024-02-15  5:53 UTC (permalink / raw)
  To: dan.carpenter@linaro.org
  Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	quic_nguyenb@quicinc.com, jejb@linux.ibm.com,
	quic_ziqichen@quicinc.com, beanhuo@micron.com,
	avri.altman@wdc.com, bvanassche@acm.org,
	martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	alim.akhtar@samsung.com, manivannan.sadhasivam@linaro.org,
	Stanley Chu (朱原陞), athierry@redhat.com,
	quic_cang@quicinc.com

On Tue, 2024-02-13 at 21:08 +0300, Dan Carpenter wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  There is one goto where "sched_clk_scaling_suspend_work" is true but
> "scale_up" is uninitialized.  It leads to a Smatch uninitialized
> variable
> warning:
> 
> drivers/ufs/core/ufshcd.c:1589 ufshcd_devfreq_target() error:
> uninitialized symbol 'scale_up'.
> 
> Fixes: 1d969731b87f ("scsi: ufs: core: Only suspend clock scaling if
> scaling down")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> 

Reviewed-by: Peter Wang <peter.wang@mediatek.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: ufs: uninitialized variable in ufshcd_devfreq_target()
  2024-02-13 18:08 [PATCH] scsi: ufs: uninitialized variable in ufshcd_devfreq_target() Dan Carpenter
  2024-02-15  5:53 ` Peter Wang (王信友)
@ 2024-02-15 18:22 ` Bart Van Assche
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2024-02-15 18:22 UTC (permalink / raw)
  To: Dan Carpenter, Peter Wang
  Cc: Alim Akhtar, Avri Altman, James E.J. Bottomley,
	Martin K. Petersen, Stanley Chu, Can Guo, Bao D. Nguyen,
	Manivannan Sadhasivam, Bean Huo, Ziqi Chen, Adrien Thierry,
	linux-scsi, linux-kernel, kernel-janitors

On 2/13/24 10:08, Dan Carpenter wrote:
> There is one goto where "sched_clk_scaling_suspend_work" is true but
> "scale_up" is uninitialized.  It leads to a Smatch uninitialized variable
> warning:
> 
> drivers/ufs/core/ufshcd.c:1589 ufshcd_devfreq_target() error: uninitialized symbol 'scale_up'.
> 
> Fixes: 1d969731b87f ("scsi: ufs: core: Only suspend clock scaling if scaling down")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   drivers/ufs/core/ufshcd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index d10a77d05d2f..a8a9edb7ba24 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -1514,7 +1514,7 @@ static int ufshcd_devfreq_target(struct device *dev,
>   	int ret = 0;
>   	struct ufs_hba *hba = dev_get_drvdata(dev);
>   	ktime_t start;
> -	bool scale_up, sched_clk_scaling_suspend_work = false;
> +	bool scale_up = false, sched_clk_scaling_suspend_work = false;
>   	struct list_head *clk_list = &hba->clk_list_head;
>   	struct ufs_clk_info *clki;
>   	unsigned long irq_flags;

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-15 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-13 18:08 [PATCH] scsi: ufs: uninitialized variable in ufshcd_devfreq_target() Dan Carpenter
2024-02-15  5:53 ` Peter Wang (王信友)
2024-02-15 18:22 ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox