[bug report] scsi: ufs: core: Only suspend clock scaling if scaling down

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Peter Wang,

The patch 1d969731b87f: "scsi: ufs: core: Only suspend clock scaling
if scaling down" from Aug 31, 2023 (linux-next), leads to the
following Smatch static checker warning:

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

drivers/ufs/core/ufshcd.c
    1382 static int ufshcd_devfreq_target(struct device *dev,
    1383                                 unsigned long *freq, u32 flags)
    1384 {
    1385         int ret = 0;
    1386         struct ufs_hba *hba = dev_get_drvdata(dev);
    1387         ktime_t start;
    1388         bool scale_up, sched_clk_scaling_suspend_work = false;
    1389         struct list_head *clk_list = &hba->clk_list_head;
    1390         struct ufs_clk_info *clki;
    1391         unsigned long irq_flags;
    1392 
    1393         if (!ufshcd_is_clkscaling_supported(hba))
    1394                 return -EINVAL;
    1395 
    1396         clki = list_first_entry(&hba->clk_list_head, struct ufs_clk_info, list);
    1397         /* Override with the closest supported frequency */
    1398         *freq = (unsigned long) clk_round_rate(clki->clk, *freq);
    1399         spin_lock_irqsave(hba->host->host_lock, irq_flags);
    1400         if (ufshcd_eh_in_progress(hba)) {
    1401                 spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
    1402                 return 0;
    1403         }
    1404 
    1405         /* Skip scaling clock when clock scaling is suspended */
    1406         if (hba->clk_scaling.is_suspended) {
    1407                 spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
    1408                 dev_warn(hba->dev, "clock scaling is suspended, skip");
    1409                 return 0;
    1410         }
    1411 
    1412         if (!hba->clk_scaling.active_reqs)
    1413                 sched_clk_scaling_suspend_work = true;
    1414 
    1415         if (list_empty(clk_list)) {
    1416                 spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
    1417                 goto out;

scale_up not initialized here.

    1418         }
    1419 
    1420         /* Decide based on the rounded-off frequency and update */
    1421         scale_up = *freq == clki->max_freq;
    1422         if (!scale_up)
    1423                 *freq = clki->min_freq;
    1424         /* Update the frequency */
    1425         if (!ufshcd_is_devfreq_scaling_required(hba, scale_up)) {
    1426                 spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
    1427                 ret = 0;
    1428                 goto out; /* no state change required */
    1429         }
    1430         spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
    1431 
    1432         start = ktime_get();
    1433         ret = ufshcd_devfreq_scale(hba, scale_up);
    1434 
    1435         trace_ufshcd_profile_clk_scaling(dev_name(hba->dev),
    1436                 (scale_up ? "up" : "down"),
    1437                 ktime_to_us(ktime_sub(ktime_get(), start)), ret);
    1438 
    1439 out:
--> 1440         if (sched_clk_scaling_suspend_work && !scale_up)
    1441                 queue_work(hba->clk_scaling.workq,
    1442                            &hba->clk_scaling.suspend_work);
    1443 
    1444         return ret;
    1445 }

regards,
dan carpenter



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux