[PATCH 25/25] scripts: ensure the cocci script for miiphy_register does not leak the MDIO bus
Vladimir Oltean
vladimir.oltean at nxp.com
Mon Sep 27 13:22:05 CEST 2021
When mdio_register fails, mdio_free should be called on the mdiodev that
was previously allocated with mdio_alloc.
Signed-off-by: Vladimir Oltean <vladimir.oltean at nxp.com>
---
scripts/coccinelle/net/mdio_register.cocci | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/coccinelle/net/mdio_register.cocci b/scripts/coccinelle/net/mdio_register.cocci
index 31a40360f99e..7d11281f4678 100644
--- a/scripts/coccinelle/net/mdio_register.cocci
+++ b/scripts/coccinelle/net/mdio_register.cocci
@@ -21,7 +21,7 @@ identifier readfunc, writefunc;
+ mdiodev->write = writefunc;
+
+ retval = mdio_register(mdiodev);
-+ if (retval < 0) return retval;
++ if (retval < 0) { mdio_free(mdiodev); return retval; }
@ update_read_sig @
identifier mii_reg.readfunc;
--
2.25.1
More information about the U-Boot
mailing list