diff options
author | Miaoqian Lin <[email protected]> | 2022-01-24 12:41:21 +0000 |
---|---|---|
committer | Suzuki K Poulose <[email protected]> | 2022-03-11 10:07:26 +0000 |
commit | cfa5dbcdd7aece76f3415284569f2f384aff0253 (patch) | |
tree | 00a24f2ffcb313413cfc5e915b907d5881936898 | |
parent | ea75a342aed5ed72c87f38fbe0df2f5df7eae374 (diff) |
coresight: syscfg: Fix memleak on registration failure in cscfg_create_device
device_register() calls device_initialize(),
according to doc of device_initialize:
Use put_device() to give up your reference instead of freeing
* @dev directly once you have called this function.
To prevent potential memleak, use put_device() for error handling.
Signed-off-by: Miaoqian Lin <[email protected]>
Fixes: 85e2414c518a ("coresight: syscfg: Initial coresight system configuration")
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mathieu Poirier <[email protected]>
Signed-off-by: Suzuki K Poulose <[email protected]>
-rw-r--r-- | drivers/hwtracing/coresight/coresight-syscfg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwtracing/coresight/coresight-syscfg.c b/drivers/hwtracing/coresight/coresight-syscfg.c index 098fc34c4829..11850fd8c3b5 100644 --- a/drivers/hwtracing/coresight/coresight-syscfg.c +++ b/drivers/hwtracing/coresight/coresight-syscfg.c @@ -1049,7 +1049,7 @@ static int cscfg_create_device(void) err = device_register(dev); if (err) - cscfg_dev_release(dev); + put_device(dev); create_dev_exit_unlock: mutex_unlock(&cscfg_mutex); |