[PATCH RESEND] Once cdev_device_add() failed, we should use put_device() to decrement reference count for cleanup. Or it could cause memory leak. Although operations in err_free_ida are similar to the operations in callback function fsi_slave_release(), put_device() is a correct handling operation as comments require when cdev_device_add() fails.

Greg KH gregkh at linuxfoundation.org
Wed Oct 22 19:48:44 AEDT 2025


On Wed, Oct 22, 2025 at 04:34:52PM +0800, Ma Ke wrote:
> As comment of device_add() says, 'if device_add() succeeds, you should
> call device_del() when you want to get rid of it. If device_add() has
> not succeeded, use only put_device() to drop the reference count'.
> 
> Found by code review.

Your subject line looks a bit messed up :(



More information about the linux-fsi mailing list