Skip to contentSkip to conversation

net: intel: e100: Fix warning of passing zero to 'PTR_ERR'

PATCH New Vasyl Gomonovych 1 participant 1 message Dec 7, 2017

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

PATCH 1/1 net: intel: e100: Fix warning of passing zero to 'PTR_ERR'

fw could be NULL and put into PTR_ERR
also zero in PTR_ERR will be translated into success return statement

---
 drivers/net/ethernet/intel/e100.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/e100.c +3 -1
index 4d10270..55e399d 100644
@@ -1370,7 +1370,9 @@ static inline int e100_load_ucode_wait(struct nic *nic)
 
 	fw = e100_request_firmware(nic);
 	/* If it's NULL, then no ucode is required */
-	if (!fw || IS_ERR(fw))
+	if (!fw)
+		return -EINVAL;
+	else if (IS_ERR(fw))
 		return PTR_ERR(fw);
 
 	if ((err = e100_exec_cb(nic, (void *)fw, e100_setup_ucode)))
Signature · 1 line
1.9.1