diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2024-01-02 14:11:16 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-04 17:01:14 +0100 |
commit | 1960932eef9183e2dab662fe75126f7fa46e0e6d (patch) | |
tree | 26b45d806c2efbf357f42656ce2e29776edc0ffa /drivers/cdx | |
parent | cdx: call of_node_put() on error path (diff) | |
download | linux-1960932eef9183e2dab662fe75126f7fa46e0e6d.tar.xz linux-1960932eef9183e2dab662fe75126f7fa46e0e6d.zip |
cdx: Unlock on error path in rescan_store()
We added locking to this function but these two error paths were
accidentally overlooked.
Fixes: f0af81683466 ("cdx: Introduce lock to protect controller ops")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
Link: https://lore.kernel.org/r/a7994b47-6f78-4e2c-a30a-ee5995d428ec@moroto.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/cdx')
-rw-r--r-- | drivers/cdx/cdx.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c index 929fe3d07eee..b74d76afccb6 100644 --- a/drivers/cdx/cdx.c +++ b/drivers/cdx/cdx.c @@ -607,7 +607,8 @@ static ssize_t rescan_store(const struct bus_type *bus, pd = of_find_device_by_node(np); if (!pd) { of_node_put(np); - return -EINVAL; + count = -EINVAL; + goto unlock; } cdx = platform_get_drvdata(pd); @@ -617,6 +618,7 @@ static ssize_t rescan_store(const struct bus_type *bus, put_device(&pd->dev); } +unlock: mutex_unlock(&cdx_controller_lock); return count; |