Merge tag 'hsi-for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi
[linux-2.6-microblaze.git] / drivers / pinctrl / pinctrl-falcon.c
index 62c02b9..7521a92 100644 (file)
@@ -431,24 +431,28 @@ static int pinctrl_falcon_probe(struct platform_device *pdev)
 
        /* load and remap the pad resources of the different banks */
        for_each_compatible_node(np, NULL, "lantiq,pad-falcon") {
-               struct platform_device *ppdev = of_find_device_by_node(np);
                const __be32 *bank = of_get_property(np, "lantiq,bank", NULL);
                struct resource res;
+               struct platform_device *ppdev;
                u32 avail;
                int pins;
 
                if (!of_device_is_available(np))
                        continue;
 
-               if (!ppdev) {
-                       dev_err(&pdev->dev, "failed to find pad pdev\n");
-                       continue;
-               }
                if (!bank || *bank >= PORTS)
                        continue;
                if (of_address_to_resource(np, 0, &res))
                        continue;
+
+               ppdev = of_find_device_by_node(np);
+               if (!ppdev) {
+                       dev_err(&pdev->dev, "failed to find pad pdev\n");
+                       continue;
+               }
+
                falcon_info.clk[*bank] = clk_get(&ppdev->dev, NULL);
+               put_device(&ppdev->dev);
                if (IS_ERR(falcon_info.clk[*bank])) {
                        dev_err(&ppdev->dev, "failed to get clock\n");
                        of_node_put(np);