Skip to contentSkip to conversation

cpcihp_generic: prevent loading without "bridge" parameter

PATCH In review Akinobu Mita 2 participants 2 messages Oct 13, 2006

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

PATCH 1/1 cpcihp_generic: prevent loading without "bridge" parameter

cpcihp_generic module requires configured "bridge" module parameter. But it can be loaded successfully without that parameter. Because module init call ends up returning positive value.

This patch prevents from loading without setting "bridge" module parameter.

Cc Greg Kroah-Hartman <[email protected]>
Cc Scott Murray <[email protected]>
drivers/pci/hotplug/cpcihp_generic.c +2 -2
Index: work-fault-inject/drivers/pci/hotplug/cpcihp_generic.c
===================================================================
@@ -84,7 +84,7 @@ static int __init validate_parameters(vo
 
 	if(!bridge) {
 		info("not configured, disabling.");
-		return 1;
+		return -EINVAL;
 	}
 	str = bridge;
 	if(!*str)
@@ -147,7 +147,7 @@ static int __init cpcihp_generic_init(vo
 
 	info(DRIVER_DESC " version: " DRIVER_VERSION);
 	status = validate_parameters();
-	if(status != 0)
+	if (status)
 		return status;
 
 	r = request_region(port, 1, "#ENUM hotswap signal register");
#1 lore raw
Quoted 9 lines · Akinobu Mita

cpcihp_generic module requires configured "bridge" module parameter. But it can be loaded successfully without that parameter. Because module init call ends up returning positive value.

This patch prevents from loading without setting "bridge" module parameter.

Cc Greg Kroah-Hartman <[email protected]>
Cc Scott Murray <[email protected]>
Quoted 22 lines

Index: work-fault-inject/drivers/pci/hotplug/cpcihp_generic.c
===================================================================

drivers/pci/hotplug/cpcihp_generic.c +2 -2
@@ -84,7 +84,7 @@ static int __init validate_parameters(vo
 
 	if(!bridge) {
 		info("not configured, disabling.");
-		return 1;
+		return -EINVAL;
 	}
 	str = bridge;
 	if(!*str)
@@ -147,7 +147,7 @@ static int __init cpcihp_generic_init(vo
 
 	info(DRIVER_DESC " version: " DRIVER_VERSION);
 	status = validate_parameters();
-	if(status != 0)
+	if (status)
 		return status;
 
 	r = request_region(port, 1, "#ENUM hotswap signal register");
Signature · 4 lines
Scott Murray
SOMA Networks, Inc.
Toronto, Ontario
e-mail: [email protected]