summaryrefslogtreecommitdiffstats
path: root/drivers/cdx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cdx')
-rw-r--r--drivers/cdx/cdx.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c
index c0fca63c7434..929fe3d07eee 100644
--- a/drivers/cdx/cdx.c
+++ b/drivers/cdx/cdx.c
@@ -604,12 +604,11 @@ static ssize_t rescan_store(const struct bus_type *bus,
/* Rescan all the devices */
for_each_compatible_node(np, NULL, compat_node_name) {
- if (!np)
- return -EINVAL;
-
pd = of_find_device_by_node(np);
- if (!pd)
+ if (!pd) {
+ of_node_put(np);
return -EINVAL;
+ }
cdx = platform_get_drvdata(pd);
if (cdx && cdx->controller_registered && cdx->ops->scan)