]> git.baikalelectronics.ru Git - kernel.git/commit
net: cosa: fix error check return value of register_chrdev()
authorLv Ruyi <lv.ruyi@zte.com.cn>
Mon, 18 Apr 2022 10:58:34 +0000 (10:58 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 Apr 2022 09:20:43 +0000 (10:20 +0100)
commit664dfae007d1a053747a3e33fe52308e9eb849ef
treef972e34640489a69e5f7e845447a2a87067ae576
parent97f11003c9b44879b34daf441079f3ded959a3b0
net: cosa: fix error check return value of register_chrdev()

If major equal 0, register_chrdev() returns error code when it fails.
This function dynamically allocate a major and return its number on
success, so we should use "< 0" to check it instead of "!".

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Acked-By: Jan "Yenya" Kasprzak <kas@fi.muni.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wan/cosa.c