Skip to content

Commit 27979e2

Browse files
committed
coresight: syscfg: Fix memleak on registration failure in cscfg_create_device
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2055405 commit cfa5dbc Author: Miaoqian Lin <linmq006@gmail.com> Date: Mon Jan 24 12:41:21 2022 +0000 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 <linmq006@gmail.com> Fixes: 85e2414 ("coresight: syscfg: Initial coresight system configuration") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220124124121.8888-1-linmq006@gmail.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Jeremy Linton <jlinton@redhat.com>
1 parent 9e392cb commit 27979e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hwtracing/coresight/coresight-syscfg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ static int cscfg_create_device(void)
10491049

10501050
err = device_register(dev);
10511051
if (err)
1052-
cscfg_dev_release(dev);
1052+
put_device(dev);
10531053

10541054
create_dev_exit_unlock:
10551055
mutex_unlock(&cscfg_mutex);

0 commit comments

Comments
 (0)