Re: [PATCH v2] macintosh: fix possible memory leak in macio_add_one_device()
From: Michael Ellerman <hidden>
Date: 2022-11-30 09:54:33
From: Michael Ellerman <hidden>
Date: 2022-11-30 09:54:33
On Fri, 4 Nov 2022 11:25:51 +0800, Yang Yingliang wrote:
Afer commit 1fa5ae857bb1 ("driver core: get rid of struct device's
bus_id string array"), the name of device is allocated dynamically,
it need be freed when of_device_register() fails, call put_device()
to give up the reference that hold in device_initialize(), so that
it can be freed in kobject_cleanup() when the refcount hit to 0.
macio device is freed in macio_release_dev(), so the kfree() can be
removed.
[...]
Applied to powerpc/next.
[1/1] macintosh: fix possible memory leak in macio_add_one_device()
https://git.kernel.org/powerpc/c/5ca86eae55a2f006e6c1edd2029b2cacb6979515
cheers