Re: [PATCH v2] net: hns: Fix missing put_device() call in hns_mac_register_phy

From: Andrew Lunn
Date: Wed Jan 12 2022 - 08:46:14 EST


On Wed, Jan 12, 2022 at 10:39:19AM +0000, Miaoqian Lin wrote:
> We need to drop the reference taken by hns_dsaf_find_platform_device
> Missing put_device() may cause refcount leak.

Is the put also missing on driver unload?

As a fix for net, it might be better to rename
dsaf_find_platform_device() to dsaf_get_platform_device() and add a
dsaf_put_platform_device(). Add similar undo functions where ever
needed, and make sure they get called.

Andrew