Skip to contentSkip to conversation

fusion: fix error handling of mpt_register()

PATCH New Dan Carpenter 1 participant 1 message Aug 6, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fusion: fix error handling of mpt_register()

mpt_register() returns a positive int between 1 and MPT_MAX_PROTOCOL_DRIVERS. It returns MPT_MAX_PROTOCOL_DRIVERS if there is no slot available. Most places don't check the return but this is how it's done in mptctl.c as well.

drivers/message/fusion/mptlan.c +1 -1
index cbe9607..42affb1 100644
@@ -1454,7 +1454,7 @@ static int __init mpt_lan_init (void)
 
 	LanCtx = mpt_register(lan_reply, MPTLAN_DRIVER,
 				"lan_reply");
-	if (LanCtx <= 0) {
+	if (LanCtx >= MPT_MAX_PROTOCOL_DRIVERS) {
 		printk (KERN_ERR MYNAM ": Failed to register with MPT base driver\n");
 		return -EBUSY;
 	}