From: Vladimir Oltean Date: Mon, 27 Sep 2021 11:22:05 +0000 (+0300) Subject: scripts: ensure the cocci script for miiphy_register does not leak the MDIO bus X-Git-Url: http://git.dujemihanovic.xyz/%22/img/sics.gif/%22/static/git-favicon.png?a=commitdiff_plain;h=4df9f5e39fb224a4857c3411b4cbe419e4d339e8;p=u-boot.git scripts: ensure the cocci script for miiphy_register does not leak the MDIO bus When mdio_register fails, mdio_free should be called on the mdiodev that was previously allocated with mdio_alloc. Signed-off-by: Vladimir Oltean --- diff --git a/scripts/coccinelle/net/mdio_register.cocci b/scripts/coccinelle/net/mdio_register.cocci index 31a40360f9..7d11281f46 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;