Skip to contentSkip to conversation

mantis: cleanup NULL checking in mantis_ca_exit()

PATCH New Dan Carpenter 1 participant 1 message Dec 2, 2012

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

PATCH 1/1 mantis: cleanup NULL checking in mantis_ca_exit()

Smatch complainst that the call to mantis_evmgr_exit() dereferences "ca" but then we check it for NULL on the next line. I've moved the NULL check forward to avoid that.

---
There aren't any callers for this function. It is commented out in mantis_dvb_exit().

drivers/media/pci/mantis/mantis_ca.c +3 -2
index 3d70469..60c6c2f 100644
@@ -198,11 +198,12 @@ void mantis_ca_exit(struct mantis_pci *mantis)
 	struct mantis_ca *ca = mantis->mantis_ca;
 
 	dprintk(MANTIS_DEBUG, 1, "Mantis CA exit");
+	if (!ca)
+		return;
 
 	mantis_evmgr_exit(ca);
 	dprintk(MANTIS_ERROR, 1, "Unregistering EN50221 device");
-	if (ca)
-		dvb_ca_en50221_release(&ca->en50221);
+	dvb_ca_en50221_release(&ca->en50221);
 
 	kfree(ca);
 }