Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dan Carpenter and committed by
Greg Kroah-Hartman
1960932e 87736ae1

+3 -1
+3 -1
drivers/cdx/cdx.c
··· 607 607 pd = of_find_device_by_node(np); 608 608 if (!pd) { 609 609 of_node_put(np); 610 - return -EINVAL; 610 + count = -EINVAL; 611 + goto unlock; 611 612 } 612 613 613 614 cdx = platform_get_drvdata(pd); ··· 618 617 put_device(&pd->dev); 619 618 } 620 619 620 + unlock: 621 621 mutex_unlock(&cdx_controller_lock); 622 622 623 623 return count;