[MLX4] Soft Reset: (bugfix in error flow) handling a case when MLX4_BUS fails during...
[mirror/winof/.git] / hw / mlx4 / kernel / bus / net / main.c
index 6d7d848..8ea460e 100644 (file)
@@ -911,6 +911,9 @@ int mlx4_init_one(struct pci_dev *pdev)
                        goto err;
 #endif
 
+       /* we are going to recreate device anyway */
+       pdev->dev = NULL;
+       
        /* find the type of device */
        id = mlx4_find_pci_dev(pdev->ven_id, pdev->dev_id);
        if (id == NULL) {
@@ -959,9 +962,12 @@ run_as_livefish:
                dev->flags |= MLX4_FLAG_LIVEFISH;
        if (mlx4_is_livefish(dev)) {
                err = mlx4_register_device(dev);
-               if (err)
+               if (err) {
                        MLX4_PRINT(TRACE_LEVEL_INFORMATION ,MLX4_DBG_LOW ,
                                ("mlx4_register_device for livefish failed, trying to proceed.\n"));
+                       pdev->dev = NULL;
+                       kfree(priv);
+               }
                goto end;
        }
 
@@ -1030,6 +1036,7 @@ err_cmd:
        mlx4_cmd_cleanup(dev);
 
 err_free_dev:
+       pdev->dev = NULL;
        kfree(priv);
 
 err: