drivers/scsi/ufs/ufshcd.c:6495 ufshcd_host_reset_and_restore() error: double unlocked (orig line 6489)

From: kernel test robot
Date: Sat Aug 08 2020 - 05:14:15 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e
commit: 5cac1095cf289f7623f835a9212b9ec0ad3b85b3 scsi: ufs: Make ufshcd_wait_for_register() sleep instead of busy-waiting
date: 3 months ago
config: arm-randconfig-m031-20200808 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

New smatch warnings:
drivers/scsi/ufs/ufshcd.c:6495 ufshcd_host_reset_and_restore() error: double unlocked '*hba->host->host_lock' (orig line 6489)

Old smatch warnings:
drivers/scsi/ufs/ufshcd.c:1430 ufshcd_suspend_clkscaling() error: double unlocked '*hba->host->host_lock' (orig line 1427)
drivers/scsi/ufs/ufshcd.c:1704 ufshcd_gate_work() error: double unlocked '*hba->host->host_lock' (orig line 1667)
drivers/scsi/ufs/ufshcd.c:2132 ufshcd_send_uic_cmd() error: double unlocked '*hba->host->host_lock' (orig line 2130)
drivers/scsi/ufs/ufshcd.c:2132 ufshcd_send_uic_cmd() error: double unlocked '*hba->host->host_lock' (orig line 2130)
drivers/scsi/ufs/ufshcd.c:2539 ufshcd_queuecommand() error: double unlocked '*hba->host->host_lock' (orig line 2501)
drivers/scsi/ufs/ufshcd.c:2661 ufshcd_wait_for_dev_cmd() error: double unlocked '*hba->host->host_lock' (orig line 2655)
drivers/scsi/ufs/ufshcd.c:2661 ufshcd_wait_for_dev_cmd() error: double unlocked '*hba->host->host_lock' (orig line 2655)
drivers/scsi/ufs/ufshcd.c:3772 ufshcd_uic_pwr_ctrl() error: double unlocked '*hba->host->host_lock' (orig line 3736)
drivers/scsi/ufs/ufshcd.c:3831 ufshcd_link_recovery() error: double unlocked '*hba->host->host_lock' (orig line 3820)
drivers/scsi/ufs/ufshcd.c:5450 ufshcd_quirk_dl_nac_errors() error: double unlocked '*hba->host->host_lock' (orig line 5430)
drivers/scsi/ufs/ufshcd.c:5468 ufshcd_quirk_dl_nac_errors() error: double unlocked '*hba->host->host_lock' (orig line 5450)
drivers/scsi/ufs/ufshcd.c:5528 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5504)
drivers/scsi/ufs/ufshcd.c:5531 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5528)
drivers/scsi/ufs/ufshcd.c:5531 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5528)
drivers/scsi/ufs/ufshcd.c:5570 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5504)
drivers/scsi/ufs/ufshcd.c:5598 ufshcd_err_handler() error: double unlocked '*hba->host->host_lock' (orig line 5570)
drivers/scsi/ufs/ufshcd.c:6587 ufshcd_eh_host_reset_handler() error: double unlocked '*hba->host->host_lock' (orig line 6574)
drivers/scsi/ufs/ufshcd.c:7910 ufshcd_hba_exit() error: double unlocked '*hba->host->host_lock' (orig line 7907)
drivers/scsi/ufs/ufshcd.c:8286 ufshcd_suspend() error: double unlocked '*hba->host->host_lock' (orig line 8193)
drivers/scsi/ufs/ufshcd.c:8297 ufshcd_suspend() error: double unlocked '*hba->host->host_lock' (orig line 8193)
drivers/scsi/ufs/ufshcd.c:8388 ufshcd_resume() error: double unlocked '*hba->host->host_lock' (orig line 8385)

vim +6495 drivers/scsi/ufs/ufshcd.c

7a3e97b0dc4bbac Santosh Yaraganavi 2012-02-29 6469
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6470 /**
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6471 * ufshcd_host_reset_and_restore - reset and restore host controller
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6472 * @hba: per-adapter instance
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6473 *
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6474 * Note that host controller reset may issue DME_RESET to
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6475 * local and remote (device) Uni-Pro stack and the attributes
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6476 * are reset to default state.
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6477 *
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6478 * Returns zero on success, non-zero on failure
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6479 */
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6480 static int ufshcd_host_reset_and_restore(struct ufs_hba *hba)
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6481 {
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6482 int err;
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6483 unsigned long flags;
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6484
2df74b6985b51e7 Can Guo 2019-11-25 6485 /*
2df74b6985b51e7 Can Guo 2019-11-25 6486 * Stop the host controller and complete the requests
2df74b6985b51e7 Can Guo 2019-11-25 6487 * cleared by h/w
2df74b6985b51e7 Can Guo 2019-11-25 6488 */
5cac1095cf289f7 Bart Van Assche 2020-05-07 @6489 ufshcd_hba_stop(hba);
5cac1095cf289f7 Bart Van Assche 2020-05-07 6490
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6491 spin_lock_irqsave(hba->host->host_lock, flags);
2df74b6985b51e7 Can Guo 2019-11-25 6492 hba->silence_err_logs = true;
2df74b6985b51e7 Can Guo 2019-11-25 6493 ufshcd_complete_requests(hba);
2df74b6985b51e7 Can Guo 2019-11-25 6494 hba->silence_err_logs = false;
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 @6495 spin_unlock_irqrestore(hba->host->host_lock, flags);
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6496
a3cd5ec55f6c728 Subhash Jadavani 2017-02-03 6497 /* scale up clocks to max frequency before full reinitialization */
394b949f2d919ce Subhash Jadavani 2020-03-26 6498 ufshcd_set_clk_freq(hba, true);
a3cd5ec55f6c728 Subhash Jadavani 2017-02-03 6499
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6500 err = ufshcd_hba_enable(hba);
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6501 if (err)
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6502 goto out;
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6503
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6504 /* Establish the link again and restore the device */
1b9e21412f72d6f Bean Huo 2020-01-20 6505 err = ufshcd_probe_hba(hba, false);
1d337ec2f35e69a Sujit Reddy Thumma 2014-09-25 6506
1d337ec2f35e69a Sujit Reddy Thumma 2014-09-25 6507 if (!err && (hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL))
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6508 err = -EIO;
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6509 out:
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6510 if (err)
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6511 dev_err(hba->dev, "%s: Host init failed %d\n", __func__, err);
8808b4e9dcdc908 Stanley Chu 2019-07-10 6512 ufshcd_update_reg_hist(&hba->ufs_stats.host_reset, (u32)err);
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6513 return err;
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6514 }
3441da7ddbdedf9 Sujit Reddy Thumma 2014-05-26 6515

:::::: The code at line 6495 was first introduced by commit
:::::: 3441da7ddbdedf91bfd5cc8609c571ffc24942dd scsi: ufs: Fix device and host reset methods

:::::: TO: Sujit Reddy Thumma <sthumma@xxxxxxxxxxxxxx>
:::::: CC: Christoph Hellwig <hch@xxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip