Browse Source

[skel] Check for ioremap() failures

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
022ef91984
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      src/drivers/net/skeleton.c

+ 5
- 0
src/drivers/net/skeleton.c View File

241
 
241
 
242
 	/* Map registers */
242
 	/* Map registers */
243
 	skel->regs = ioremap ( pci->membase, SKELETON_BAR_SIZE );
243
 	skel->regs = ioremap ( pci->membase, SKELETON_BAR_SIZE );
244
+	if ( ! skel->regs ) {
245
+		rc = -ENODEV;
246
+		goto err_ioremap;
247
+	}
244
 
248
 
245
 	/* Reset the NIC */
249
 	/* Reset the NIC */
246
 	if ( ( rc = skeleton_reset ( skel ) ) != 0 )
250
 	if ( ( rc = skeleton_reset ( skel ) ) != 0 )
269
 	skeleton_reset ( skel );
273
 	skeleton_reset ( skel );
270
  err_reset:
274
  err_reset:
271
 	iounmap ( skel->regs );
275
 	iounmap ( skel->regs );
276
+ err_ioremap:
272
 	netdev_nullify ( netdev );
277
 	netdev_nullify ( netdev );
273
 	netdev_put ( netdev );
278
 	netdev_put ( netdev );
274
  err_alloc:
279
  err_alloc:

Loading…
Cancel
Save