Fixed null pointer dereference on loading e100 driver for 2.6.32.
--- a/devices/e100-2.6.32-ethercat.c Fri Nov 04 13:19:03 2011 +0100
+++ b/devices/e100-2.6.32-ethercat.c Wed Nov 09 09:55:58 2011 +0100
@@ -1,6 +1,6 @@
/******************************************************************************
*
- * $Id$
+ * $Id: e100-2.6.32-ethercat.c,v d05df15dcc6c 2011/09/22 16:51:31 fp $
*
* Copyright (C) 2007-2008 Florian Pose, Ingenieurgemeinschaft IgH
*
@@ -2984,18 +2984,15 @@
// offer device to EtherCAT master module
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
- if (nic->ecdev) {
- if (ecdev_open(nic->ecdev)) {
- ecdev_withdraw(nic->ecdev);
- goto err_out_free;
- }
- } else {
+
+ if (!nic->ecdev) {
strcpy(netdev->name, "eth%d");
if((err = register_netdev(netdev))) {
DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n");
goto err_out_free;
}
}
+
nic->cbs_pool = pci_pool_create(netdev->name,
nic->pdev,
nic->params.cbs.count * sizeof(struct cb),
@@ -3005,6 +3002,13 @@
(unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0),
pdev->irq, netdev->dev_addr);
+ if (nic->ecdev) {
+ if (ecdev_open(nic->ecdev)) {
+ ecdev_withdraw(nic->ecdev);
+ goto err_out_free;
+ }
+ }
+
return 0;
err_out_free: