]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/ata/libahci_platform.c
Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux.git] / drivers / ata / libahci_platform.c
index 9e9583a6bba99295601cc92399c94e85f623cef3..e742780950de84c330c2c83b1daf1a0905f03ed0 100644 (file)
@@ -497,6 +497,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
 
                        if (of_property_read_u32(child, "reg", &port)) {
                                rc = -EINVAL;
+                               of_node_put(child);
                                goto err_out;
                        }
 
@@ -514,14 +515,18 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
                        if (port_dev) {
                                rc = ahci_platform_get_regulator(hpriv, port,
                                                                &port_dev->dev);
-                               if (rc == -EPROBE_DEFER)
+                               if (rc == -EPROBE_DEFER) {
+                                       of_node_put(child);
                                        goto err_out;
+                               }
                        }
 #endif
 
                        rc = ahci_platform_get_phy(hpriv, port, dev, child);
-                       if (rc)
+                       if (rc) {
+                               of_node_put(child);
                                goto err_out;
+                       }
 
                        enabled_ports++;
                }