net/mlx5: Fix race between PCI error handlers and health work
[cascardo/linux.git] / drivers / crypto / ixp4xx_crypto.c
index 2296934..7868765 100644 (file)
@@ -447,9 +447,8 @@ static int init_ixp_crypto(struct device *dev)
 
        if (!npe_running(npe_c)) {
                ret = npe_load_firmware(npe_c, npe_name(npe_c), dev);
-               if (ret) {
-                       return ret;
-               }
+               if (ret)
+                       goto npe_release;
                if (npe_recv_message(npe_c, msg, "STATUS_MSG"))
                        goto npe_error;
        } else {
@@ -473,7 +472,8 @@ static int init_ixp_crypto(struct device *dev)
        default:
                printk(KERN_ERR "Firmware of %s lacks crypto support\n",
                        npe_name(npe_c));
-               return -ENODEV;
+               ret = -ENODEV;
+               goto npe_release;
        }
        /* buffer_pool will also be used to sometimes store the hmac,
         * so assure it is large enough
@@ -512,6 +512,7 @@ npe_error:
 err:
        dma_pool_destroy(ctx_pool);
        dma_pool_destroy(buffer_pool);
+npe_release:
        npe_release(npe_c);
        return ret;
 }