net: ravb: Fix error handling in ravb_probe
authorPaul Barker <paul.barker.ct@bp.renesas.com>
Tue, 4 Mar 2025 20:07:09 +0000 (20:07 +0000)
committerMarek Vasut <marek.vasut+renesas@mailbox.org>
Wed, 19 Mar 2025 02:37:41 +0000 (03:37 +0100)
commit667ab63f931bc16b38c1ce87f57a4914c1c7bcfa
tree5a9d039497ad208efdeefaf0bf2d139e57fb7769
parente2c060588681d87aaa12ccbccf2cb2135249efc4
net: ravb: Fix error handling in ravb_probe

In ravb_probe(), we were missing a couple of things in the error
handling path:

  * We must unregister the MDIO bus before freeing the corresponding
    struct mii_dev instance to avoid the potential for use-after-free
    bugs.

  * We must free the resources acquired by clk_get_bulk() even if the
    clocks have not yet been enabled.

Fixes: 8ae51b6f324e ("net: ravb: Add Renesas Ethernet RAVB driver")
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
drivers/net/ravb.c