stm class: Fix module init return on allocation failure
authorWang Hui <john.wanghui@huawei.com>
Fri, 15 Jan 2021 19:59:16 +0000 (22:59 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jan 2021 10:55:15 +0000 (11:55 +0100)
commit225c87b40a78f31a47e5c97358c6e5bb731fd571
tree1a1b34f9e96e69bfcbf44afe607c7a83b33685b0
parentf583ccebacdfb0ee097dba6f079d0b5182e88dd9
stm class: Fix module init return on allocation failure

commit 927633a6d20af319d986f3e42c3ef9f6d7835008 upstream.

In stm_heartbeat_init(): return value gets reset after the first
iteration by stm_source_register_device(), so allocation failures
after that will, after a clean up, return success. Fix that.

Fixes: 119291853038 ("stm class: Add heartbeat stm source device")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hui <john.wanghui@huawei.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Link: https://lore.kernel.org/r/20210115195917.3184-2-alexander.shishkin@linux.intel.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/stm/heartbeat.c