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-Tag: v2022.01-rc1~40^2~6^2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4df9f5e39fb224a4857c3411b4cbe419e4d339e8;p=pandora-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 31a40360f99..7d11281f467 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;