[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20231129141041.34275-1-liuhaoran14@163.com>
Date: Wed, 29 Nov 2023 06:10:41 -0800
From: Haoran Liu <liuhaoran14@....com>
To: pedrom.sousa@...opsys.com
Cc: jejb@...ux.ibm.com, martin.petersen@...cle.com,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
Haoran Liu <liuhaoran14@....com>
Subject: [PATCH] [ufs] tc-dwc-g210: Add error handling in tc_dwc_g210_pltfm_probe
This patch adds error handling for the of_match_node call in the
tc_dwc_g210_pltfm_probe function within
drivers/ufs/host/tc-dwc-g210-pltfrm.c. Previously, the function did
not properly handle a null return value from of_match_node, which could
lead to issues if the device tree matching failed.
Signed-off-by: Haoran Liu <liuhaoran14@....com>
---
drivers/ufs/host/tc-dwc-g210-pltfrm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/ufs/host/tc-dwc-g210-pltfrm.c b/drivers/ufs/host/tc-dwc-g210-pltfrm.c
index a3877592604d..991069bfe570 100644
--- a/drivers/ufs/host/tc-dwc-g210-pltfrm.c
+++ b/drivers/ufs/host/tc-dwc-g210-pltfrm.c
@@ -59,6 +59,11 @@ static int tc_dwc_g210_pltfm_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
of_id = of_match_node(tc_dwc_g210_pltfm_match, dev->of_node);
+ if (!of_id) {
+ dev_err(dev, "No matching device found\n");
+ return -ENODEV;
+ }
+
vops = (struct ufs_hba_variant_ops *)of_id->data;
/* Perform generic probe */
--
2.17.1
Powered by blists - more mailing lists