lkml.org 
[lkml]   [2023]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] [ufs] tc-dwc-g210: Add error handling in tc_dwc_g210_pltfm_probe
Date
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@163.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
\
 
 \ /
  Last update: 2023-11-29 15:11    [W:0.093 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site