Add the missing unlock before return from function gpio_sim_config_commit_item() in the error handling case. Fixes: b48f6b466e44 ("gpio: sim: new testing module") Reported-by: Hulk Robot <hulkci@xxxxxxxxxx> Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx> --- drivers/gpio/gpio-sim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c index d8bf84b604d9..e2113092f85b 100644 --- a/drivers/gpio/gpio-sim.c +++ b/drivers/gpio/gpio-sim.c @@ -789,8 +789,10 @@ static int gpio_sim_config_commit_item(struct config_item *item) config->num_line_names); fwnode = fwnode_create_software_node(properties, NULL); - if (IS_ERR(fwnode)) + if (IS_ERR(fwnode)) { + mutex_unlock(&config->lock); return PTR_ERR(fwnode); + } pdevinfo.name = "gpio-sim"; pdevinfo.fwnode = fwnode;