mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
cdx: Unlock on error path in rescan_store()
We added locking to this function but these two error paths were
accidentally overlooked.
Fixes: f0af816834
("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>
This commit is contained in:
parent
87736ae12e
commit
1960932eef
1 changed files with 3 additions and 1 deletions
|
@ -607,7 +607,8 @@ static ssize_t rescan_store(const struct bus_type *bus,
|
||||||
pd = of_find_device_by_node(np);
|
pd = of_find_device_by_node(np);
|
||||||
if (!pd) {
|
if (!pd) {
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
return -EINVAL;
|
count = -EINVAL;
|
||||||
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
cdx = platform_get_drvdata(pd);
|
cdx = platform_get_drvdata(pd);
|
||||||
|
@ -617,6 +618,7 @@ static ssize_t rescan_store(const struct bus_type *bus,
|
||||||
put_device(&pd->dev);
|
put_device(&pd->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock:
|
||||||
mutex_unlock(&cdx_controller_lock);
|
mutex_unlock(&cdx_controller_lock);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|
Loading…
Add table
Reference in a new issue