Skip to content

Commit 1960932

Browse files
Dan Carpentergregkh
authored andcommitted
cdx: Unlock on error path in rescan_store()
We added locking to this function but these two error paths were accidentally overlooked. Fixes: f0af816 ("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>
1 parent 87736ae commit 1960932

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/cdx/cdx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,8 @@ static ssize_t rescan_store(const struct bus_type *bus,
607607
pd = of_find_device_by_node(np);
608608
if (!pd) {
609609
of_node_put(np);
610-
return -EINVAL;
610+
count = -EINVAL;
611+
goto unlock;
611612
}
612613

613614
cdx = platform_get_drvdata(pd);
@@ -617,6 +618,7 @@ static ssize_t rescan_store(const struct bus_type *bus,
617618
put_device(&pd->dev);
618619
}
619620

621+
unlock:
620622
mutex_unlock(&cdx_controller_lock);
621623

622624
return count;

0 commit comments

Comments
 (0)