]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/crypto/ux500/hash/hash_core.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[mirror_ubuntu-artful-kernel.git] / drivers / crypto / ux500 / hash / hash_core.c
index 632c3339895f8b35f68cd3a0b4a7eeb3f3d2f052..cf55089675398145e4481d810076553465b6031f 100644 (file)
@@ -32,7 +32,6 @@
 #include <crypto/algapi.h>
 
 #include <linux/platform_data/crypto-ux500.h>
-#include <mach/hardware.h>
 
 #include "hash_alg.h"
 
@@ -939,6 +938,7 @@ static int hash_dma_final(struct ahash_request *req)
        if (!ctx->device->dma.nents) {
                dev_err(device_data->dev, "[%s] "
                                "ctx->device->dma.nents = 0", __func__);
+               ret = ctx->device->dma.nents;
                goto out;
        }
 
@@ -946,6 +946,7 @@ static int hash_dma_final(struct ahash_request *req)
        if (bytes_written != req->nbytes) {
                dev_err(device_data->dev, "[%s] "
                                "hash_dma_write() failed!", __func__);
+               ret = bytes_written;
                goto out;
        }
 
@@ -1368,14 +1369,12 @@ static int hash_setkey(struct crypto_ahash *tfm,
        /**
         * Freed in final.
         */
-       ctx->key = kmalloc(keylen, GFP_KERNEL);
+       ctx->key = kmemdup(key, keylen, GFP_KERNEL);
        if (!ctx->key) {
                pr_err(DEV_DBG_NAME " [%s] Failed to allocate ctx->key "
                       "for %d\n", __func__, alg);
                return -ENOMEM;
        }
-
-       memcpy(ctx->key, key, keylen);
        ctx->keylen = keylen;
 
        return ret;