Re: [PATCH] net: mctp: fix device leak on probe failure
From: Jeremy Kerr
Date: Thu Mar 05 2026 - 20:23:48 EST
+CC Greg
Context is Johan's patch at
https://lore.kernel.org/netdev/20260305104549.16110-1-johan@xxxxxxxxxx/
Cheers,
Jeremy
> Hi John,
>
> > Driver core holds a reference to the USB interface and its parent USB
> > device while the interface is bound to a driver and there is no need to
> > take additional references unless the structures are needed after
> > disconnect.
> >
> > This driver takes a reference to the USB device during probe but does
> > not to release it on probe failures.
> >
> > Drop the redundant device reference to fix the leak, reduce cargo
> > culting, make it easier to spot drivers where an extra reference is
> > needed, and reduce the risk of further memory leaks.
>
> Sounds good, but I would suggest syncing with Greg K-H too; he's in the
> process of doing a v2 for the same thing:
>
> https://lore.kernel.org/netdev/2026022539-punch-supper-884c@gregkh/
>
> Given the discussion there, this looks in-line with the longer-term move
> from usb_get_dev(), so:
>
> Acked-by: Jeremy Kerr <jk@xxxxxxxxxxxxxxxxxxxx>
>
> Thanks,
>
>
> Jeremy