[PATCH] [ufs] tc-dwc-g210: Add error handling in tc_dwc_g210_pltfm_probe

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

 



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@xxxxxxx>
---
 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





[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