Commit a3cbf68c authored by Ma Ke's avatar Ma Ke Committed by Leon Romanovsky
Browse files

RDMA/srp: Fix error handling in srp_add_port



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.

Add a put_device() call before returning from the function to decrement
reference count for cleanup.

Found by code review.

Fixes: c8e4c239 ("RDMA/srp: Rework the srp_add_port() error path")
Signed-off-by: default avatarMa Ke <make_ruc2021@163.com>
Link: https://patch.msgid.link/20241217075538.2909996-1-make_ruc2021@163.com


Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent db03b709
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment