mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-12-04 01:36:58 -05:00
scsi: megaraid: Fix error check return value of register_chrdev()
[ Upstream commit c5acd61dbb32b6bda0f3a354108f2b8dcb788985 ] If major equals 0, register_chrdev() returns an error code when it fails. This function dynamically allocates a major and returns its number on success, so we should use "< 0" to check it instead of "!". Link: https://lore.kernel.org/r/[email protected] Reported-by: Zeal Robot <[email protected]> Signed-off-by: Lv Ruyi <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
7923f95997
commit
e1599ced6b
1 changed files with 1 additions and 1 deletions
|
|
@ -4635,7 +4635,7 @@ static int __init megaraid_init(void)
|
|||
* major number allocation.
|
||||
*/
|
||||
major = register_chrdev(0, "megadev_legacy", &megadev_fops);
|
||||
if (!major) {
|
||||
if (major < 0) {
|
||||
printk(KERN_WARNING
|
||||
"megaraid: failed to register char device\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue