Skip to contentSkip to conversation

c2port: checking for NULL instead of IS_ERR()

PATCH Applied Dan Carpenter 2 participants 2 messages Apr 12, 2017

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

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

c2port_device_register() never returns NULL, it uses error pointers.

Fixes 65131cd52b9e ("c2port: add c2port support for Eurotech Duramar 2150")
drivers/misc/c2port/c2port-duramar2150.c +2 -2
index 5484301d57d9..3dc61ea7dc64 100644
@@ -129,8 +129,8 @@ static int __init duramar2150_c2port_init(void)
 
 	duramar2150_c2port_dev = c2port_device_register("uc",
 					&duramar2150_c2port_ops, NULL);
-	if (!duramar2150_c2port_dev) {
-		ret = -ENODEV;
+	if (IS_ERR(duramar2150_c2port_dev)) {
+		ret = PTR_ERR(duramar2150_c2port_dev);
 		goto free_region;
 	}
 
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Dan Carpenter

c2port_device_register() never returns NULL, it uses error pointers.

Fixes 65131cd52b9e ("c2port: add c2port support for Eurotech Duramar 2150")
Quoted 16 lines
drivers/misc/c2port/c2port-duramar2150.c +2 -2
index 5484301d57d9..3dc61ea7dc64 100644
@@ -129,8 +129,8 @@ static int __init duramar2150_c2port_init(void)
 
 	duramar2150_c2port_dev = c2port_device_register("uc",
 					&duramar2150_c2port_ops, NULL);
-	if (!duramar2150_c2port_dev) {
-		ret = -ENODEV;
+	if (IS_ERR(duramar2150_c2port_dev)) {
+		ret = PTR_ERR(duramar2150_c2port_dev);
 		goto free_region;
 	}
 
Signature · 7 lines
HCE Engineering                      e-mail: [email protected]
GNU/Linux Solutions                          [email protected]
Linux Device Driver                          [email protected]
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it