Commit 1960932e authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

cdx: Unlock on error path in rescan_store()

We added locking to this function but these two error paths were
accidentally overlooked.

Fixes: f0af8168 ("cdx: Introduce lock to protect controller ops")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Acked-by: default avatarAbhijit Gangurde <abhijit.gangurde@amd.com>
Link: https://lore.kernel.org/r/a7994b47-6f78-4e2c-a30a-ee5995d428ec@moroto.mountainSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 87736ae1
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment