]> git.itanic.dy.fi Git - linux-stable/commitdiff
MIPS: OCTEON: add put_device() after of_find_device_by_node()
authorYe Guojin <ye.guojin@zte.com.cn>
Tue, 16 Nov 2021 08:10:51 +0000 (08:10 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 08:04:29 +0000 (09:04 +0100)
[ Upstream commit 858779df1c0787d3fec827fb705708df9ebdb15b ]

This was found by coccicheck:
./arch/mips/cavium-octeon/octeon-platform.c, 332, 1-7, ERROR missing
put_device; call of_find_device_by_node on line 324, but without a
corresponding object release within this function.
./arch/mips/cavium-octeon/octeon-platform.c, 395, 1-7, ERROR missing
put_device; call of_find_device_by_node on line 387, but without a
corresponding object release within this function.
./arch/mips/cavium-octeon/octeon-usb.c, 512, 3-9, ERROR missing
put_device; call of_find_device_by_node on line 515, but without a
corresponding object release within this function.
./arch/mips/cavium-octeon/octeon-usb.c, 543, 1-7, ERROR missing
put_device; call of_find_device_by_node on line 515, but without a
corresponding object release within this function.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/mips/cavium-octeon/octeon-platform.c
arch/mips/cavium-octeon/octeon-usb.c

index 5ba181e87d2c1ff2dab04190f700c7db9bcbf8af..4d83f5bc7211c18bb5728b78bb13efade74c6d4c 100644 (file)
@@ -328,6 +328,7 @@ static int __init octeon_ehci_device_init(void)
 
        pd->dev.platform_data = &octeon_ehci_pdata;
        octeon_ehci_hw_start(&pd->dev);
+       put_device(&pd->dev);
 
        return ret;
 }
@@ -391,6 +392,7 @@ static int __init octeon_ohci_device_init(void)
 
        pd->dev.platform_data = &octeon_ohci_pdata;
        octeon_ohci_hw_start(&pd->dev);
+       put_device(&pd->dev);
 
        return ret;
 }
index 75189ff2f3c78315f6c550174188a03d7563ab00..3465452e28195a3cd2f28a2ca47971f3f99f812e 100644 (file)
@@ -543,6 +543,7 @@ static int __init dwc3_octeon_device_init(void)
                        devm_iounmap(&pdev->dev, base);
                        devm_release_mem_region(&pdev->dev, res->start,
                                                resource_size(res));
+                       put_device(&pdev->dev);
                }
        } while (node != NULL);