asix: fix wrong return value in asix_check_host_enable()
authorPavel Skripkin <paskripkin@gmail.com>
Tue, 21 Dec 2021 20:10:43 +0000 (23:10 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Dec 2021 11:28:45 +0000 (12:28 +0100)
commit5cf03976e1f00b008928256255abc803e3872153
tree6f408bf877468ae177e7591703dd46e4079892dd
parentd259f621c85949f30cc578cac813b82bb5169f56
asix: fix wrong return value in asix_check_host_enable()

[ Upstream commit d1652b70d07cc3eed96210c876c4879e1655f20e ]

If asix_read_cmd() returns 0 on 30th interation, 0 will be returned from
asix_check_host_enable(), which is logically wrong. Fix it by returning
-ETIMEDOUT explicitly if we have exceeded 30 iterations

Also, replaced 30 with #define as suggested by Andrew

Fixes: a786e3195d6a ("net: asix: fix uninit value bugs")
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/ecd3470ce6c2d5697ac635d0d3b14a47defb4acb.1640117288.git.paskripkin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/usb/asix_common.c