Skip to content
Commit b2ea5f49 authored by Ma Ke's avatar Ma Ke Committed by Vinod Koul
Browse files

phy: Fix error handling in tegra_xusb_port_init



If device_add() fails, do not use device_unregister() for error
handling. device_unregister() consists two functions: device_del() and
put_device(). device_unregister() should only be called after
device_add() succeeded because device_del() undoes what device_add()
does if successful. Change device_unregister() to put_device() call
before returning from the function.

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.

Cc: stable@vger.kernel.org
Fixes: 53d2a715 ("phy: Add Tegra XUSB pad controller support")
Signed-off-by: default avatarMa Ke <make24@iscas.ac.cn>
Acked-by: default avatarThierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20250303072739.3874987-1-make24@iscas.ac.cn


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 86e70849
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment