summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2016-03-04 17:36:10 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-03 07:23:24 +0300
commit2040e80d8095e6aff0743944011cbaf94252ecc0 (patch)
tree35f5c9f7843afacf8a89d950f7df4fc6736bc513
parentfbfaa26fa9e77f4b8b141f650340195f23cd7029 (diff)
downloadlinux-2040e80d8095e6aff0743944011cbaf94252ecc0.tar.xz
stm class: Do not leak the chrdev in error path
[ Upstream commit cbe4a61d1ddc4790d950ca8c33ef79ee68ef5e2b ] Currently, the error path of stm_register_device() forgets to unregister the chrdev. Fix this. Reported-by: Alan Cox <alan.cox@intel.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reviewed-by: Laurent Fert <laurent.fert@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/hwtracing/stm/core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index 03b34dcff7f2..0c7f0bae001a 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -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: