stm class: Add a missing call to put_device
PATCH 1/1 stm class: Add a missing call to put_device
Most error branches following the call to class_find_device contain a call to put_device. This patch add calls to put_device where they are missing.
This issue was found with Hector.
--- drivers/hwtracing/stm/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwtracing/stm/core.c +3 -1
@@ -368,8 +368,10 @@ static int stm_char_open(struct inode *ireturn -ENODEV ; stmf =kzalloc (sizeof (*stmf),GFP_KERNEL ); -if (!stmf) +if (!stmf) { +put_device (dev);return -ENOMEM ; + }stm_output_init (&stmf->output); stmf->stm =to_stm_device (dev);
Alexander Shishkin
maintainerQuoted 15 lines · Quentin Lambert
Most error branches following the call to
class_find_devicecontain a call toput_device. This patch add calls toput_devicewhere they are missing.This issue was found with Hector.
Signed-off-by Quentin Lambert <[email protected]>--- drivers/hwtracing/stm/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwtracing/stm/core.c static int stm_char_open(struct inode *i · line 374
Quoted 8 lines
drivers/hwtracing/stm/core.c +3
-1@@ -368,8 +368,10 @@ static int stm_char_open(struct inode *ireturn -ENODEV ; stmf =kzalloc (sizeof (*stmf),GFP_KERNEL ); -if (!stmf) +if (!stmf) { +put_device (dev);return -ENOMEM ; + }
There is a goto label at the bottom of this function which is supposed
to deal with this. See the fix that we already have [1] for this issue.
[1] https://git.kernel.org/cgit/linux/kernel/git/ash/stm.git/commit/?h=stm-for-greg-20161118&id ebf519b8a2666438d999c62995618c710573e5
Regards,
--
alex
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 28 lines · Alexander Shishkin
Quoted 15 lines · Quentin Lambert
Most error branches following the call to
class_find_devicecontain a call toput_device. This patch add calls toput_devicewhere they are missing.This issue was found with Hector.
Signed-off-by Quentin Lambert <[email protected]>--- drivers/hwtracing/stm/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/hwtracing/stm/core.c static int stm_char_open(struct inode *i · line 374
Quoted 8 lines
drivers/hwtracing/stm/core.c +3
-1@@ -368,8 +368,10 @@ static int stm_char_open(struct inode *ireturn -ENODEV ; stmf =kzalloc (sizeof (*stmf),GFP_KERNEL ); -if (!stmf) +if (!stmf) { +put_device (dev);return -ENOMEM ; + }There is a goto label at the bottom of this function which is supposed
to deal with this. See the fix that we already have [1] for this issue.
Quoted 5 lines
[1] https://git.kernel.org/cgit/linux/kernel/git/ash/stm.git/commit/?h=stm-for-greg-20161118&id ebf519b8a2666438d999c62995618c710573e5
Regards,
--
alex
Your fix is better, you are right, I did not use the goto label because of the free.
Thanks for your feedback though.
Regards,
Quentin
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html