Skip to contentSkip to conversation

pps: checking for NULL instead of IS_ERR()

PATCH New Dan Carpenter 1 participant 1 message Feb 8, 2012

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

PATCH 1/1 pps: checking for NULL instead of IS_ERR()

class_create() never returns NULLs only ERR_PTRs.

drivers/pps/pps.c +2 -2
index 2baadd2..98fbe62 100644
@@ -369,9 +369,9 @@ static int __init pps_init(void)
 	int err;
 
 	pps_class = class_create(THIS_MODULE, "pps");
-	if (!pps_class) {
+	if (IS_ERR(pps_class)) {
 		pr_err("failed to allocate class\n");
-		return -ENOMEM;
+		return PTR_ERR(pps_class);
 	}
 	pps_class->dev_attrs = pps_attrs;