Commit 3c811e1a authored by Alexander Shishkin's avatar Alexander Shishkin Committed by Stefan Bader

stm class: Do not leak the chrdev in error path

BugLink: https://bugs.launchpad.net/bugs/1826212

[ Upstream commit cbe4a61d ]

Currently, the error path of stm_register_device() forgets to unregister
the chrdev. Fix this.
Reported-by: default avatarAlan Cox <alan.cox@intel.com>
Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: default avatarLaurent Fert <laurent.fert@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 8289652f
......@@ -686,6 +686,8 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
return 0;
err_device:
unregister_chrdev(stm->major, stm_data->name);
/* matches device_initialize() above */
put_device(&stm->dev);
err_free:
......
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