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

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.mountain


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 87736ae1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;