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)
committerJakub Kicinski <kuba@kernel.org>
Wed, 22 Dec 2021 22:52:18 +0000 (14:52 -0800)
commitd1652b70d07cc3eed96210c876c4879e1655f20e
treed503e4535ff207336db7a223581d707ef8e8f85a
parent8035b1a2a37a29d8c717ef84fca8fe7278bc9f03
asix: fix wrong return value in asix_check_host_enable()

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>
drivers/net/usb/asix_common.c