Re: [PATCH v6 11/11] scsi: ufs: core: Move code out of an if-statement

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

 



Hi,

On 16/10/2024 22:12, Bart Van Assche wrote:
The previous patch in this series introduced identical code in both
branches of an if-statement. Move that code outside the if-statement.

Reviewed-by: Bao D. Nguyen <quic_nguyenb@xxxxxxxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
  drivers/ufs/core/ufshcd.c | 32 +++++++++++++-------------------
  1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index f34563e3a51d..70d89e154c4f 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -10400,26 +10400,20 @@ static int ufshcd_add_scsi_host(struct ufs_hba *hba)
  			dev_err(hba->dev, "MCQ mode is disabled, err=%d\n",
  				err);
  		}
-		err = scsi_add_host(hba->host, hba->dev);
-		if (err) {
-			dev_err(hba->dev, "scsi_add_host failed\n");
-			return err;
-		}
-		hba->scsi_host_added = true;
-	} else {
-		if (!hba->lsdb_sup) {
-			dev_err(hba->dev,
-				"%s: failed to initialize (legacy doorbell mode not supported)\n",
-				__func__);
-			return -EINVAL;
-		}
-		err = scsi_add_host(hba->host, hba->dev);
-		if (err) {
-			dev_err(hba->dev, "scsi_add_host failed\n");
-			return err;
-		}
-		hba->scsi_host_added = true;
  	}
+	if (!is_mcq_supported(hba) && !hba->lsdb_sup) {
+		dev_err(hba->dev,
+			"%s: failed to initialize (legacy doorbell mode not supported)\n",
+			__func__);
+		return -EINVAL;
+	}
+
+	err = scsi_add_host(hba->host, hba->dev);
+	if (err) {
+		dev_err(hba->dev, "scsi_add_host failed\n");
+		return err;
+	}
+	hba->scsi_host_added = true;
hba->tmf_tag_set = (struct blk_mq_tag_set) {
  		.nr_hw_queues	= 1,


This change regresses the Qualcomm SM8650 Platforms, QRD and HDK boards fails to boot:
https://git.codelinaro.org/linaro/qcomlt/ci/staging/cdba-tester/-/jobs/182758#L1200

[    5.155432] ufshcd-qcom 1d84000.ufshc: Resource ufs_mem not provided
[    5.155439] ufshcd-qcom 1d84000.ufshc: MCQ mode is disabled, err=-19
[    5.155443] ufshcd-qcom 1d84000.ufshc: ufshcd_add_scsi_host: failed to initialize (legacy doorbell mode not supported)
[    5.155874] ufshcd-qcom 1d84000.ufshc: error -EINVAL: Initialization failed with error -22

then causes system crash:
[   15.400948] Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
<snip>
[   15.544573] CPU: 1 UID: 0 PID: 87 Comm: kworker/1:1 Tainted: G S                 6.12.0-rc5-next-20241030 #1
[   15.554938] Tainted: [S]=CPU_OUT_OF_SPEC
[   15.559098] Hardware name: Qualcomm Technologies, Inc. SM8650 QRD (DT)
[   15.565984] Workqueue: events ufshcd_rtc_work
[   15.570628] pstate: 234000c5 (nzCv daIF +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
[   15.577986] pc : _raw_spin_lock_irqsave+0x34/0x8c
[   15.582981] lr : pm_runtime_get_if_active+0x24/0x9c
[   15.588159] sp : ffff800080df3d10
[   15.591679] x29: ffff800080df3d10 x28: 0000000000000000 x27: 0000000000000000
[   15.599235] x26: 0000000000000000 x25: ffff713a408fa1c0 x24: ffff713a40020205
[   15.606788] x23: 0000000000000000 x22: 0000000000000001 x21: ffff713a427ca848
[   15.614344] x20: 00000000000002a4 x19: 0000000000000000 x18: 0000000000000000
[   15.621896] x17: 0000000000000000 x16: 0000000000000000 x15: 00003a474f4572ec
[   15.629449] x14: 0000476e937c7726 x13: ffff713a40b64580 x12: 0000000000000001
[   15.637005] x11: 000000038cd4b97b x10: 3fb907ccb9c2fb76 x9 : 1eb87ffdfb6b34c8
[   15.644559] x8 : ffff713a40b655e8 x7 : ffff713a408fa200 x6 : 0000000000000020
[   15.652113] x5 : 000073746e657665 x4 : 0000000000000000 x3 : 000000003b9ac9ff
[   15.659665] x2 : 0000000000000001 x1 : 0000000000000000 x0 : 00000000000002a4
[   15.667218] Call trace:
[   15.669833]  _raw_spin_lock_irqsave+0x34/0x8c (P)
[   15.674829]  pm_runtime_get_if_active+0x24/0x9c (L)
[   15.679998]  pm_runtime_get_if_active+0x24/0x9c
[   15.684811]  ufshcd_rtc_work+0x138/0x1b4
[   15.688991]  process_one_work+0x148/0x288
[   15.693258]  worker_thread+0x2cc/0x3d4
[   15.697248]  kthread+0x110/0x114
[   15.700703]  ret_from_fork+0x10/0x20
[   15.704516] Code: b9000841 d503201f 52800001 52800022 (88e17c02)
[   15.710956] ---[ end trace 0000000000000000 ]---

Since next-20241028, bisect log on next-20241030:
# bad: [86e3904dcdc7e70e3257fc1de294a1b75f3d8d04] Add linux-next specific files for 20241030
# good: [81983758430957d9a5cb3333fe324fd70cf63e7e] Linux 6.12-rc5
git bisect start 'HEAD' 'v6.12-rc5'
# good: [9bebee868a9f662d3829e7529b99d63f14245673] Merge branch 'nand/next' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git
git bisect good 9bebee868a9f662d3829e7529b99d63f14245673
# good: [64f1d5c3ad7542ea8f979988d2af75fd4e18148e] Merge branch 'for-backlight-next' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
git bisect good 64f1d5c3ad7542ea8f979988d2af75fd4e18148e
# good: [38754c326c1fa76b673652b406d06d10004bf372] Merge branch 'char-misc-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
git bisect good 38754c326c1fa76b673652b406d06d10004bf372
# bad: [08b6666d1a597b0ac3753ed4228707e5067db303] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git
git bisect bad 08b6666d1a597b0ac3753ed4228707e5067db303
# good: [27709a220e05ec666c65b2266162bdd51a1f9b58] Merge branch 'spmi-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git
git bisect good 27709a220e05ec666c65b2266162bdd51a1f9b58
# good: [0edaa545afbbcd7e8ff162f9fd8852c3589d2fa6] staging: gpib: fmh_gpib: Fix typo
git bisect good 0edaa545afbbcd7e8ff162f9fd8852c3589d2fa6
# bad: [b92e5937e3523b0b7d41373681256bec78d7e134] scsi: ufs: core: Move code out of an if-statement
git bisect bad b92e5937e3523b0b7d41373681256bec78d7e134
# good: [a3517717c3c0dbad771f5e491191b4b7b69808fb] Merge patch series "scsi: hisi_sas: Some fixes for hisi_sas"
git bisect good a3517717c3c0dbad771f5e491191b4b7b69808fb
# good: [5824e18b3db468e6eb5e9ef226eed80db26f581a] scsi: ufs: core: Remove redundant host_lock calls around UTMRLCLR
git bisect good 5824e18b3db468e6eb5e9ef226eed80db26f581a
# good: [0936001322646a15d7091f61232e5ded9bf1883f] scsi: ufs: core: Convert a comment into an explicit check
git bisect good 0936001322646a15d7091f61232e5ded9bf1883f
# good: [a390e6677f4119e3b9e6364ac2c5cbe3ef1321a2] scsi: ufs: core: Expand the ufshcd_device_init(hba, true) call
git bisect good a390e6677f4119e3b9e6364ac2c5cbe3ef1321a2
# good: [72e979225ed2e9427396e317d33050bcf50ad899] scsi: ufs: core: Move the MCQ scsi_add_host() call
git bisect good 72e979225ed2e9427396e317d33050bcf50ad899
# first bad commit: [b92e5937e3523b0b7d41373681256bec78d7e134] scsi: ufs: core: Move code out of an if-statement

#regzbot introduced b92e5937e3523b0b7d41373681256bec78d7e134

Thanks,
Neil




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux