]> git.baikalelectronics.ru Git - kernel.git/commit
visorbus: fix error return code in visorchipset_init()
authorZhen Lei <thunder.leizhen@huawei.com>
Fri, 28 May 2021 08:26:14 +0000 (16:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:53:42 +0000 (16:53 +0200)
commit71275656f4299da2ac9951a72dc23ce206115aa8
tree5eb4f84b4cd55bcc15dba15c18d6fb8062468d05
parent5aff6090ffd9692ba27a491819fc4f5beebac3f2
visorbus: fix error return code in visorchipset_init()

[ Upstream commit ce52ec5beecc1079c251f60e3973b3758f60eb59 ]

Commit 52f80b7464ae ("staging: unisys: visorbus: visorchipset_init clean
up gotos") assigns the initial value -ENODEV to the local variable 'err',
and the first several error branches will return this value after "goto
error". But commit 89a2cb857088 ("staging: unisys: visorbus: Consolidate
controlvm channel creation.") overwrites 'err' in the middle of the way.
As a result, some error branches do not successfully return the initial
value -ENODEV of 'err', but return 0.

In addition, when kzalloc() fails, -ENOMEM should be returned instead of
-ENODEV.

Fixes: 89a2cb857088 ("staging: unisys: visorbus: Consolidate controlvm channel creation.")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20210528082614.9337-1-thunder.leizhen@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/visorbus/visorchipset.c