[PATCH -next] crypto: mxs-dcp: make symbols 'sha1_null_hash' and 'sha256_null_hash' static

2018-10-10 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/crypto/mxs-dcp.c:39:15: warning:
 symbol 'sha1_null_hash' was not declared. Should it be static?
drivers/crypto/mxs-dcp.c:43:15: warning:
 symbol 'sha256_null_hash' was not declared. Should it be static?

Fixes: c709eebaf5c5 ("crypto: mxs-dcp - Fix SHA null hashes and output length")
Signed-off-by: Wei Yongjun 
---
 drivers/crypto/mxs-dcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
index 849a81e..4e6ff32 100644
--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -36,11 +36,11 @@
  * Null hashes to align with hw behavior on imx6sl and ull
  * these are flipped for consistency with hw output
  */
-const uint8_t sha1_null_hash[] =
+static const uint8_t sha1_null_hash[] =
"\x09\x07\xd8\xaf\x90\x18\x60\x95\xef\xbf"
"\x55\x32\x0d\x4b\x6b\x5e\xee\xa3\x39\xda";
 
-const uint8_t sha256_null_hash[] =
+static const uint8_t sha256_null_hash[] =
"\x55\xb8\x52\x78\x1b\x99\x95\xa4"
"\x4c\x93\x9b\x64\xe4\x41\xae\x27"
"\x24\xb9\x6f\x99\xc8\xf4\xfb\x9a"



[PATCH -next v2] crypto: ccp - Make function sev_get_firmware() static

2018-09-25 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/crypto/ccp/psp-dev.c:444:5: warning:
 symbol 'sev_get_firmware' was not declared. Should it be static?

Fixes: e93720606efd ("crypto: ccp - Allow SEV firmware to be chosen based on 
Family and Model")
Signed-off-by: Wei Yongjun 
---
v1 -> v2: add fixes and add cc Janakarajan
---
 drivers/crypto/ccp/psp-dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index 3b33863..d64a78c 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -441,7 +441,8 @@ static int sev_get_api_version(void)
return 0;
 }
 
-int sev_get_firmware(struct device *dev, const struct firmware **firmware)
+static int sev_get_firmware(struct device *dev,
+   const struct firmware **firmware)
 {
char fw_name_specific[SEV_FW_NAME_SIZE];
char fw_name_subset[SEV_FW_NAME_SIZE];



[PATCH -next] crypto: ccp - Make function sev_get_firmware() static

2018-09-25 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/crypto/ccp/psp-dev.c:444:5: warning:
 symbol 'sev_get_firmware' was not declared. Should it be static?

Signed-off-by: Wei Yongjun 
---
 drivers/crypto/ccp/psp-dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index 3b33863..d64a78c 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -441,7 +441,8 @@ static int sev_get_api_version(void)
return 0;
 }
 
-int sev_get_firmware(struct device *dev, const struct firmware **firmware)
+static int sev_get_firmware(struct device *dev,
+   const struct firmware **firmware)
 {
char fw_name_specific[SEV_FW_NAME_SIZE];
char fw_name_subset[SEV_FW_NAME_SIZE];



[PATCH -next] crypto: hisilicon - Make function sec_send_request() static

2018-08-07 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/crypto/hisilicon/sec/sec_algs.c:396:5: warning:
 symbol 'sec_send_request' was not declared. Should it be static?

Fixes: 915e4e8413da ("crypto: hisilicon - SEC security accelerator driver")
Signed-off-by: Wei Yongjun 
---
 drivers/crypto/hisilicon/sec/sec_algs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/hisilicon/sec/sec_algs.c 
b/drivers/crypto/hisilicon/sec/sec_algs.c
index d69d3ce..03ba1df 100644
--- a/drivers/crypto/hisilicon/sec/sec_algs.c
+++ b/drivers/crypto/hisilicon/sec/sec_algs.c
@@ -393,7 +393,8 @@ static void sec_alg_free_el(struct sec_request_el *el,
 }
 
 /* queuelock must be held */
-int sec_send_request(struct sec_request *sec_req, struct sec_queue *queue)
+static int sec_send_request(struct sec_request *sec_req,
+   struct sec_queue *queue)
 {
struct sec_request_el *el, *temp;
int ret = 0;



[PATCH -next] crypto: fix missing unlock on error in safexcel_ahash_send_req()

2018-03-13 Thread Wei Yongjun
Add the missing unlock before return from function
safexcel_ahash_send_req() in the error handling case.

Fixes: cff9a17545a3 ("crypto: inside-secure - move cache result dma mapping to 
request")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/inside-secure/safexcel_hash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/inside-secure/safexcel_hash.c 
b/drivers/crypto/inside-secure/safexcel_hash.c
index 77268c9..6e9eb9b 100644
--- a/drivers/crypto/inside-secure/safexcel_hash.c
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
@@ -236,8 +236,10 @@ static int safexcel_ahash_send_req(struct 
crypto_async_request *async, int ring,
if (cache_len) {
req->cache_dma = dma_map_single(priv->dev, req->cache,
cache_len, DMA_TO_DEVICE);
-   if (dma_mapping_error(priv->dev, req->cache_dma))
+   if (dma_mapping_error(priv->dev, req->cache_dma)) {
+   spin_unlock_bh(>ring[ring].egress_lock);
return -EINVAL;
+   }
 
req->cache_sz = cache_len;
first_cdesc = safexcel_add_cdesc(priv, ring, 1,



[PATCH -next] hwrng: make symbol imx_rngc_pm_ops static

2018-01-22 Thread Wei Yongjun
Fixes the following sparse warnings:

drivers/char/hw_random/imx-rngc.c:303:1: warning:
 symbol 'imx_rngc_pm_ops' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/char/hw_random/imx-rngc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/imx-rngc.c 
b/drivers/char/hw_random/imx-rngc.c
index eca8724..250123b 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -300,7 +300,7 @@ static int __maybe_unused imx_rngc_resume(struct device 
*dev)
return 0;
 }
 
-SIMPLE_DEV_PM_OPS(imx_rngc_pm_ops, imx_rngc_suspend, imx_rngc_resume);
+static SIMPLE_DEV_PM_OPS(imx_rngc_pm_ops, imx_rngc_suspend, imx_rngc_resume);
 
 static const struct of_device_id imx_rngc_dt_ids[] = {
{ .compatible = "fsl,imx25-rngb", .data = NULL, },



[PATCH -next] crypto: stm32 - remove redundant dev_err call in stm32_cryp_probe()

2018-01-17 Thread Wei Yongjun
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/stm32/stm32-cryp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/stm32/stm32-cryp.c 
b/drivers/crypto/stm32/stm32-cryp.c
index cf1dddb..4a06a7a 100644
--- a/drivers/crypto/stm32/stm32-cryp.c
+++ b/drivers/crypto/stm32/stm32-cryp.c
@@ -1052,10 +1052,8 @@ static int stm32_cryp_probe(struct platform_device *pdev)
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
cryp->regs = devm_ioremap_resource(dev, res);
-   if (IS_ERR(cryp->regs)) {
-   dev_err(dev, "Cannot map CRYP IO\n");
+   if (IS_ERR(cryp->regs))
return PTR_ERR(cryp->regs);
-   }
 
irq = platform_get_irq(pdev, 0);
if (irq < 0) {



[PATCH -next] hwrng: bcm2835 - Remove redundant dev_err call in bcm2835_rng_probe()

2018-01-17 Thread Wei Yongjun
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/char/hw_random/bcm2835-rng.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/char/hw_random/bcm2835-rng.c 
b/drivers/char/hw_random/bcm2835-rng.c
index 25e5631..7a84cec 100644
--- a/drivers/char/hw_random/bcm2835-rng.c
+++ b/drivers/char/hw_random/bcm2835-rng.c
@@ -158,10 +158,8 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
 
/* map peripheral */
priv->base = devm_ioremap_resource(dev, r);
-   if (IS_ERR(priv->base)) {
-   dev_err(dev, "failed to remap rng regs");
+   if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
-   }
 
/* Clock is optional on most platforms */
priv->clk = devm_clk_get(dev, NULL);





[PATCH -next] crypto: axis - remove unnecessary platform_get_resource() error check

2018-01-17 Thread Wei Yongjun
devm_ioremap_resource() already checks if the resource is NULL, so
remove the unnecessary platform_get_resource() error check.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/axis/artpec6_crypto.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/crypto/axis/artpec6_crypto.c 
b/drivers/crypto/axis/artpec6_crypto.c
index 0f9754e..02e8739 100644
--- a/drivers/crypto/axis/artpec6_crypto.c
+++ b/drivers/crypto/axis/artpec6_crypto.c
@@ -3041,9 +3041,6 @@ static int artpec6_crypto_probe(struct platform_device 
*pdev)
variant = (enum artpec6_crypto_variant)match->data;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res)
-   return -ENODEV;
-
base = devm_ioremap_resource(>dev, res);
if (IS_ERR(base))
return PTR_ERR(base);



[PATCH -next] staging: ccree: remove redundant dev_err call in init_cc_resources()

2018-01-11 Thread Wei Yongjun
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/staging/ccree/cc_driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/ccree/cc_driver.c 
b/drivers/staging/ccree/cc_driver.c
index 6682d9d..c27d5a8 100644
--- a/drivers/staging/ccree/cc_driver.c
+++ b/drivers/staging/ccree/cc_driver.c
@@ -174,10 +174,8 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
req_mem_cc_regs = platform_get_resource(plat_dev, IORESOURCE_MEM, 0);
/* Map registers space */
new_drvdata->cc_base = devm_ioremap_resource(dev, req_mem_cc_regs);
-   if (IS_ERR(new_drvdata->cc_base)) {
-   dev_err(dev, "Failed to ioremap registers");
+   if (IS_ERR(new_drvdata->cc_base))
return PTR_ERR(new_drvdata->cc_base);
-   }
 
dev_dbg(dev, "Got MEM resource (%s): %pR\n", req_mem_cc_regs->name,
req_mem_cc_regs);



[PATCH -next] hwrng: exynos - remove redundant dev_err call in exynos_trng_probe()

2018-01-10 Thread Wei Yongjun
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/char/hw_random/exynos-trng.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/char/hw_random/exynos-trng.c 
b/drivers/char/hw_random/exynos-trng.c
index 34d6f51..4c8a2be 100644
--- a/drivers/char/hw_random/exynos-trng.c
+++ b/drivers/char/hw_random/exynos-trng.c
@@ -129,10 +129,8 @@ static int exynos_trng_probe(struct platform_device *pdev)
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
trng->mem = devm_ioremap_resource(>dev, res);
-   if (IS_ERR(trng->mem)) {
-   dev_err(>dev, "Could not map IO resources.\n");
+   if (IS_ERR(trng->mem))
return PTR_ERR(trng->mem);
-   }
 
pm_runtime_enable(>dev);
ret = pm_runtime_get_sync(>dev);



[PATCH -next] crypto: stm32 - Fix OF module alias information

2017-04-25 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

The module alias information passed to MODULE_DEVICE_TABLE()
should use stm32_dt_ids instead of undefined sti_dt_ids.

Fixes: b51dbe90912a ("crypto: stm32 - Support for STM32 CRC32 crypto module")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/stm32/stm32_crc32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/stm32/stm32_crc32.c 
b/drivers/crypto/stm32/stm32_crc32.c
index 7652822..ec83b1e 100644
--- a/drivers/crypto/stm32/stm32_crc32.c
+++ b/drivers/crypto/stm32/stm32_crc32.c
@@ -306,7 +306,7 @@ static const struct of_device_id stm32_dt_ids[] = {
{ .compatible = "st,stm32f7-crc", },
{},
 };
-MODULE_DEVICE_TABLE(of, sti_dt_ids);
+MODULE_DEVICE_TABLE(of, stm32_dt_ids);
 
 static struct platform_driver stm32_crc_driver = {
.probe  = stm32_crc_probe,



[PATCH -next] crypto: caam - fix error return code in caam_qi_init()

2017-04-11 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fix to return error code -ENOMEM from the kmem_cache_create() error
handling case instead of 0(err is 0 here), as done elsewhere in this
function.

Fixes: 67c2315def06 ("crypto: caam - add Queue Interface (QI) backend support")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/caam/qi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/caam/qi.c b/drivers/crypto/caam/qi.c
index 45de8fd..1990ed4 100644
--- a/drivers/crypto/caam/qi.c
+++ b/drivers/crypto/caam/qi.c
@@ -789,7 +789,7 @@ int caam_qi_init(struct platform_device *caam_pdev)
dev_err(qidev, "Can't allocate CAAM cache\n");
free_rsp_fqs();
platform_device_unregister(qi_pdev);
-   return err;
+   return -ENOMEM;
}
 
/* Done with the CGRs; restore the cpus allowed mask */



[PATCH -next] crypto: asymmetric_keys - Fix error return code on failure

2017-02-09 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fix to return error code -ENOMEM from the akcipher_request_alloc()
error handling case instead of 0.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 crypto/asymmetric_keys/public_key.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/crypto/asymmetric_keys/public_key.c 
b/crypto/asymmetric_keys/public_key.c
index 3a23274..3131bba 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -184,8 +184,10 @@ static int software_key_eds_op(struct kernel_pkey_params 
*params,
return PTR_ERR(tfm);
 
req = akcipher_request_alloc(tfm, GFP_KERNEL);
-   if (!req)
+   if (!req) {
+   ret = -ENOMEM;
goto error_free_tfm;
+   }
 
if (pkey->key_is_private)
ret = crypto_akcipher_set_priv_key(tfm,
@@ -268,8 +270,10 @@ int public_key_verify_signature(const struct public_key 
*pkey,
return PTR_ERR(tfm);
 
req = akcipher_request_alloc(tfm, GFP_KERNEL);
-   if (!req)
+   if (!req) {
+   ret = -ENOMEM;
goto error_free_tfm;
+   }
 
if (pkey->key_is_private)
ret = crypto_akcipher_set_priv_key(tfm,



[PATCH -next] crypto: mediatek - make symbol of_crypto_id static

2017-01-12 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fixes the following sparse warning:

drivers/crypto/mediatek/mtk-platform.c:585:27: warning:
 symbol 'of_crypto_id' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/mediatek/mtk-platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/mediatek/mtk-platform.c 
b/drivers/crypto/mediatek/mtk-platform.c
index 286296f..a9c713d 100644
--- a/drivers/crypto/mediatek/mtk-platform.c
+++ b/drivers/crypto/mediatek/mtk-platform.c
@@ -582,7 +582,7 @@ static int mtk_crypto_remove(struct platform_device *pdev)
return 0;
 }
 
-const struct of_device_id of_crypto_id[] = {
+static const struct of_device_id of_crypto_id[] = {
{ .compatible = "mediatek,eip97-crypto" },
{},
 };

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] hwrng: atmel - use clk_disable_unprepare instead of clk_disable

2016-11-11 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Since clk_prepare_enable() is used to get trng->clk, we should
use clk_disable_unprepare() to release it for the error path.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/char/hw_random/atmel-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/atmel-rng.c 
b/drivers/char/hw_random/atmel-rng.c
index ae7cae5..661c82c 100644
--- a/drivers/char/hw_random/atmel-rng.c
+++ b/drivers/char/hw_random/atmel-rng.c
@@ -94,7 +94,7 @@ static int atmel_trng_probe(struct platform_device *pdev)
return 0;
 
 err_register:
-   clk_disable(trng->clk);
+   clk_disable_unprepare(trng->clk);
return ret;
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] crypto: drop pointless static qualifier in atmel_aes_probe()

2016-10-24 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

There is no need to have the 'struct atmel_aes_dev *aes_dd' variable
static since new value always be assigned before use it.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/atmel-aes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index 6b656f4..0e3d0d6 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -2311,7 +2311,7 @@ static int atmel_aes_probe(struct platform_device *pdev)
 
 static int atmel_aes_remove(struct platform_device *pdev)
 {
-   static struct atmel_aes_dev *aes_dd;
+   struct atmel_aes_dev *aes_dd;
 
aes_dd = platform_get_drvdata(pdev);
if (!aes_dd)

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] crypto: ccp - Fix non static symbol warning

2016-10-17 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fixes the following sparse warning:

drivers/crypto/ccp/ccp-dev.c:44:6: warning:
 symbol 'ccp_error_codes' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/ccp/ccp-dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
index cafa633..c25515a 100644
--- a/drivers/crypto/ccp/ccp-dev.c
+++ b/drivers/crypto/ccp/ccp-dev.c
@@ -41,7 +41,7 @@ struct ccp_tasklet_data {
 };
 
 /* Human-readable error strings */
-char *ccp_error_codes[] = {
+static char *ccp_error_codes[] = {
"",
"ERR 01: ILLEGAL_ENGINE",
"ERR 02: ILLEGAL_KEY_ID",

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] crypto: gcm - Fix error return code in crypto_gcm_create_common()

2016-10-17 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fix to return error code -EINVAL from the invalid alg ivsize error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 crypto/gcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/gcm.c b/crypto/gcm.c
index f624ac9..39c261d 100644
--- a/crypto/gcm.c
+++ b/crypto/gcm.c
@@ -672,11 +672,11 @@ static int crypto_gcm_create_common(struct 
crypto_template *tmpl,
ctr = crypto_spawn_skcipher_alg(>ctr);
 
/* We only support 16-byte blocks. */
+   err = -EINVAL;
if (crypto_skcipher_alg_ivsize(ctr) != 16)
goto out_put_ctr;
 
/* Not a stream cipher? */
-   err = -EINVAL;
if (ctr->base.cra_blocksize != 1)
goto out_put_ctr;

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: ccp - Fix return value check in ccp_dmaengine_register()

2016-09-17 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fix the retrn value check which testing the wrong variable
in ccp_dmaengine_register().

Fixes: 58ea8abf4904 ("crypto: ccp - Register the CCP as a DMA resource")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/ccp/ccp-dmaengine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/ccp-dmaengine.c 
b/drivers/crypto/ccp/ccp-dmaengine.c
index 94f77b0..32f645e 100644
--- a/drivers/crypto/ccp/ccp-dmaengine.c
+++ b/drivers/crypto/ccp/ccp-dmaengine.c
@@ -650,7 +650,7 @@ int ccp_dmaengine_register(struct ccp_device *ccp)
dma_desc_cache_name = devm_kasprintf(ccp->dev, GFP_KERNEL,
 "%s-dmaengine-desc-cache",
 ccp->name);
-   if (!dma_cmd_cache_name)
+   if (!dma_desc_cache_name)
return -ENOMEM;
ccp->dma_desc_cache = kmem_cache_create(dma_desc_cache_name,
sizeof(struct ccp_dma_desc),

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] hwrng: geode - fix return value check in mod_init()

2016-09-15 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.

Fixes: 6e9b5e76882c ("hwrng: geode - Migrate to managed API")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/char/hw_random/geode-rng.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/geode-rng.c 
b/drivers/char/hw_random/geode-rng.c
index 0cae210..e7a2459 100644
--- a/drivers/char/hw_random/geode-rng.c
+++ b/drivers/char/hw_random/geode-rng.c
@@ -95,8 +95,8 @@ static int __init mod_init(void)
return -ENODEV;
 
mem = devm_ioremap(>dev, rng_base, 0x58);
-   if (IS_ERR(mem))
-   return PTR_ERR(mem);
+   if (!mem)
+   return -ENOMEM;
geode_rng.priv = (unsigned long)mem;
 
pr_info("AMD Geode RNG detected\n");

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] hwrng: amd - Fix return value check in mod_init()

2016-09-15 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

In case of error, the function devm_kzalloc() or devm_ioport_map()
return NULL pointer not ERR_PTR(). The IS_ERR() test in the return
value check should be replaced with NULL test.

Fixes: 31b2a73c9c5f ("hwrng: amd - Migrate to managed API")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/char/hw_random/amd-rng.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/char/hw_random/amd-rng.c b/drivers/char/hw_random/amd-rng.c
index 4dbc5aa..4a99ac7 100644
--- a/drivers/char/hw_random/amd-rng.c
+++ b/drivers/char/hw_random/amd-rng.c
@@ -149,8 +149,8 @@ static int __init mod_init(void)
return -EIO;
 
priv = devm_kzalloc(>dev, sizeof(*priv), GFP_KERNEL);
-   if (IS_ERR(priv))
-   return PTR_ERR(priv);
+   if (!priv)
+   return -ENOMEM;
 
if (!devm_request_region(>dev, pmbase + PMBASE_OFFSET,
PMBASE_SIZE, DRV_NAME)) {
@@ -161,9 +161,9 @@ static int __init mod_init(void)
 
priv->iobase = devm_ioport_map(>dev, pmbase + PMBASE_OFFSET,
PMBASE_SIZE);
-   if (IS_ERR(priv->iobase)) {
+   if (!priv->iobase) {
pr_err(DRV_NAME "Cannot map ioport\n");
-   return PTR_ERR(priv->iobase);
+   return -ENOMEM;
}
 
amd_rng.priv = (unsigned long)priv;

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] crypto: ccp - use kmem_cache_zalloc instead of kmem_cache_alloc/memset

2016-09-14 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/ccp/ccp-dmaengine.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/ccp/ccp-dmaengine.c 
b/drivers/crypto/ccp/ccp-dmaengine.c
index ded26f4..2e5a05c 100644
--- a/drivers/crypto/ccp/ccp-dmaengine.c
+++ b/drivers/crypto/ccp/ccp-dmaengine.c
@@ -299,12 +299,10 @@ static struct ccp_dma_desc *ccp_alloc_dma_desc(struct 
ccp_dma_chan *chan,
 {
struct ccp_dma_desc *desc;
 
-   desc = kmem_cache_alloc(chan->ccp->dma_desc_cache, GFP_NOWAIT);
+   desc = kmem_cache_zalloc(chan->ccp->dma_desc_cache, GFP_NOWAIT);
if (!desc)
return NULL;
 
-   memset(desc, 0, sizeof(*desc));
-
dma_async_tx_descriptor_init(>tx_desc, >dma_chan);
desc->tx_desc.flags = flags;
desc->tx_desc.tx_submit = ccp_tx_submit;

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] crypto: omap-aes - fix error return code in omap_aes_probe()

2016-09-14 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fix to return error code -ENOMEM from the crypto_engine_alloc_init()
error handling case instead of 0, as done elsewhere in this function.

Fixes: 0529900a01cb ("crypto: omap-aes - Support crypto engine framework")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/omap-aes.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index 2033769..fe32dd9 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -1215,8 +1215,10 @@ static int omap_aes_probe(struct platform_device *pdev)
 
/* Initialize crypto engine */
dd->engine = crypto_engine_alloc_init(dev, 1);
-   if (!dd->engine)
+   if (!dd->engine) {
+   err = -ENOMEM;
goto err_engine;
+   }
 
dd->engine->prepare_cipher_request = omap_aes_prepare_req;
dd->engine->cipher_one_request = omap_aes_crypt_req;

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] crypto: omap-des - fix error return code in omap_des_probe()

2016-09-14 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fix to return error code -ENOMEM from the crypto_engine_alloc_init()
error handling case instead of 0, as done elsewhere in this function.

Fixes: f1b77aaca85a ("crypto: omap-des - Integrate with the crypto
engine framework")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/omap-des.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index 2b20d96..a6f6553 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -1081,8 +1081,10 @@ static int omap_des_probe(struct platform_device *pdev)
 
/* Initialize des crypto engine */
dd->engine = crypto_engine_alloc_init(dev, 1);
-   if (!dd->engine)
+   if (!dd->engine) {
+   err = -ENOMEM;
goto err_engine;
+   }
 
dd->engine->prepare_cipher_request = omap_des_prepare_req;
dd->engine->cipher_one_request = omap_des_crypt_req;

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] hwrng: st - Fix missing clk_disable_unprepare() on error in st_rng_probe()

2016-09-10 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fix the missing clk_disable_unprepare() before return
from st_rng_probe() in the error handling case.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/char/hw_random/st-rng.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/hw_random/st-rng.c b/drivers/char/hw_random/st-rng.c
index 7e8aa6b..938ec10 100644
--- a/drivers/char/hw_random/st-rng.c
+++ b/drivers/char/hw_random/st-rng.c
@@ -108,6 +108,7 @@ static int st_rng_probe(struct platform_device *pdev)
ret = hwrng_register(>ops);
if (ret) {
dev_err(>dev, "Failed to register HW RNG\n");
+   clk_disable_unprepare(clk);
return ret;
}
 



--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next v2] chcr: Fix non static symbol warning

2016-08-26 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fixes the following sparse warning:

drivers/crypto/chelsio/chcr_algo.c:593:5: warning:
 symbol 'cxgb4_is_crypto_q_full' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
v1 -> v2: cc netdev maillist
---
 drivers/crypto/chelsio/chcr_algo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c 
b/drivers/crypto/chelsio/chcr_algo.c
index ad8e353..e4ddb92 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -590,7 +590,7 @@ badkey_err:
return -EINVAL;
 }
 
-int cxgb4_is_crypto_q_full(struct net_device *dev, unsigned int idx)
+static int cxgb4_is_crypto_q_full(struct net_device *dev, unsigned int idx)
 {
int ret = 0;
struct sge_ofld_txq *q;

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] chcr: Fix non static symbol warning

2016-08-22 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fixes the following sparse warning:

drivers/crypto/chelsio/chcr_algo.c:593:5: warning:
 symbol 'cxgb4_is_crypto_q_full' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/crypto/chelsio/chcr_algo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c 
b/drivers/crypto/chelsio/chcr_algo.c
index ad8e353..e4ddb92 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -590,7 +590,7 @@ badkey_err:
return -EINVAL;
 }
 
-int cxgb4_is_crypto_q_full(struct net_device *dev, unsigned int idx)
+static int cxgb4_is_crypto_q_full(struct net_device *dev, unsigned int idx)
 {
int ret = 0;
struct sge_ofld_txq *q;



--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] crypto: drbg - fix error return code

2016-08-20 Thread Wei Yongjun
Fix to return a negative error code from the error handling
case instead of 0.

Signed-off-by: Wei Yongjun <weiyj...@gmail.com>
---
 crypto/drbg.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/crypto/drbg.c b/crypto/drbg.c
index edf3ce0..fb33f7d 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1178,12 +1178,16 @@ static inline int drbg_alloc_state(struct drbg_state 
*drbg)
goto err;
 
drbg->Vbuf = kmalloc(drbg_statelen(drbg) + ret, GFP_KERNEL);
-   if (!drbg->Vbuf)
+   if (!drbg->Vbuf) {
+   ret = -ENOMEM;
goto fini;
+   }
drbg->V = PTR_ALIGN(drbg->Vbuf, ret + 1);
drbg->Cbuf = kmalloc(drbg_statelen(drbg) + ret, GFP_KERNEL);
-   if (!drbg->Cbuf)
+   if (!drbg->Cbuf) {
+   ret = -ENOMEM;
goto fini;
+   }
drbg->C = PTR_ALIGN(drbg->Cbuf, ret + 1);
/* scratchpad is only generated for CTR and Hash */
if (drbg->core->flags & DRBG_HMAC)
@@ -1199,8 +1203,10 @@ static inline int drbg_alloc_state(struct drbg_state 
*drbg)
 
if (0 < sb_size) {
drbg->scratchpadbuf = kzalloc(sb_size + ret, GFP_KERNEL);
-   if (!drbg->scratchpadbuf)
+   if (!drbg->scratchpadbuf) {
+   ret = -ENOMEM;
goto fini;
+   }
drbg->scratchpad = PTR_ALIGN(drbg->scratchpadbuf, ret + 1);
}
 
@@ -1999,7 +2005,7 @@ static int __init drbg_init(void)
 {
unsigned int i = 0; /* pointer to drbg_algs */
unsigned int j = 0; /* pointer to drbg_cores */
-   int ret = -EFAULT;
+   int ret;
 
ret = drbg_healthcheck_sanity();
if (ret)
@@ -2009,7 +2015,7 @@ static int __init drbg_init(void)
pr_info("DRBG: Cannot register all DRBG types"
"(slots needed: %zu, slots available: %zu)\n",
ARRAY_SIZE(drbg_cores) * 2, ARRAY_SIZE(drbg_algs));
-   return ret;
+   return -EFAULT;
}
 
/*

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next v2] crypto: sun4i-ss - fix missing unlock on error in sun4i_hash()

2016-08-20 Thread Wei Yongjun
Add the missing unlock before return from function sun4i_hash()
in the error handling case.

Fixes: 477d9b2e591b ("crypto: sun4i-ss - unify update/final function")
Signed-off-by: Wei Yongjun <weiyj...@gmail.com>
---
v1 -> v2: goto release_ss as LABBE Corentin's suggestion
---
 drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c 
b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
index 2ee3b59..1afeb8e 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
@@ -245,7 +245,8 @@ int sun4i_hash(struct ahash_request *areq)
if (end > areq->nbytes || areq->nbytes - end > 63) {
dev_err(ss->dev, "ERROR: Bound error %u %u\n",
end, areq->nbytes);
-   return -EINVAL;
+   err = -EINVAL;
+   goto release_ss;
}
} else {
/* Since we have the flag final, we can go up to modulo 4 */

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] crypto: fix missing unlock on error in sun4i_hash()

2016-08-18 Thread Wei Yongjun
Add the missing unlock before return from function sun4i_hash()
in the error handling case.

Fixes: 477d9b2e591b ("crypto: sun4i-ss - unify update/final function")
Signed-off-by: Wei Yongjun <weiyj...@gmail.com>
---
 drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c 
b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
index 2ee3b59..de66f47 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
@@ -245,6 +245,7 @@ int sun4i_hash(struct ahash_request *areq)
if (end > areq->nbytes || areq->nbytes - end > 63) {
dev_err(ss->dev, "ERROR: Bound error %u %u\n",
end, areq->nbytes);
+   spin_unlock(>slock);
return -EINVAL;
}
} else {

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] crypto: ccp - Fix non static symbol warning

2016-08-11 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/crypto/ccp/ccp-dev.c:62:14: warning:
 symbol 'ccp_increment_unit_ordinal' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyj...@gmail.com>
---
 drivers/crypto/ccp/ccp-dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
index 38a98d8..5d36eef 100644
--- a/drivers/crypto/ccp/ccp-dev.c
+++ b/drivers/crypto/ccp/ccp-dev.c
@@ -59,7 +59,7 @@ static struct ccp_device *ccp_rr;
 
 /* Ever-increasing value to produce unique unit numbers */
 static atomic_t ccp_unit_ordinal;
-unsigned int ccp_increment_unit_ordinal(void)
+static unsigned int ccp_increment_unit_ordinal(void)
 {
return atomic_inc_return(_unit_ordinal);
 }



--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] crypto: mxs - Fix sparse non static symbol warning

2014-01-08 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

Fixes the following sparse warning:

drivers/crypto/mxs-dcp.c:103:1: warning:
 symbol 'global_mutex' was not declared. Should it be static?

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/crypto/mxs-dcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
index d41917c..a6db7fa 100644
--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -100,7 +100,7 @@ struct dcp_sha_req_ctx {
  * design of Linux Crypto API.
  */
 static struct dcp *global_sdcp;
-DEFINE_MUTEX(global_mutex);
+static DEFINE_MUTEX(global_mutex);
 
 /* DCP register layout. */
 #define MXS_DCP_CTRL   0x00

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: hifn_795x - fix to pass correct device identity to free_irq()

2013-05-28 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

free_irq() expects the same device identity that was passed
to request_irq(), otherwise the IRQ is not freed.

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/crypto/hifn_795x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index ebf130e..12fea3e 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2676,7 +2676,7 @@ err_out_stop_device:
hifn_reset_dma(dev, 1);
hifn_stop_device(dev);
 err_out_free_irq:
-   free_irq(dev-irq, dev-name);
+   free_irq(dev-irq, dev);
tasklet_kill(dev-tasklet);
 err_out_free_desc:
pci_free_consistent(pdev, sizeof(struct hifn_dma),
@@ -2711,7 +2711,7 @@ static void hifn_remove(struct pci_dev *pdev)
hifn_reset_dma(dev, 1);
hifn_stop_device(dev);
 
-   free_irq(dev-irq, dev-name);
+   free_irq(dev-irq, dev);
tasklet_kill(dev-tasklet);
 
hifn_flush(dev);

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: tegra-aes - fix error-valued pointer dereference

2012-10-25 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

clk_put(dd-aes_clk) will dereference an error-valued pointer since the
dd-aes_clk is a ERR_PTR() value. The correct check is call clk_put()
if !IS_ERR(dd-aes_clk).

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/crypto/tegra-aes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/tegra-aes.c b/drivers/crypto/tegra-aes.c
index 37185e6..bb4195a 100644
--- a/drivers/crypto/tegra-aes.c
+++ b/drivers/crypto/tegra-aes.c
@@ -1031,7 +1031,7 @@ out:
if (dd-buf_out)
dma_free_coherent(dev, AES_HW_DMA_BUFFER_SIZE_BYTES,
dd-buf_out, dd-dma_buf_out);
-   if (IS_ERR(dd-aes_clk))
+   if (!IS_ERR(dd-aes_clk))
clk_put(dd-aes_clk);
if (aes_wq)
destroy_workqueue(aes_wq);


--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: convert to use be16_add_cpu()

2012-09-27 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

Convert cpu_to_be16(be16_to_cpu(E1) + E2) to use be16_add_cpu().

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/crypto/talitos.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index efff788..c1bf42f 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -919,8 +919,7 @@ static int sg_to_link_tbl(struct scatterlist *sg, int 
sg_count,
sg_count--;
link_tbl_ptr--;
}
-   link_tbl_ptr-len = cpu_to_be16(be16_to_cpu(link_tbl_ptr-len)
-   + cryptlen);
+   be16_add_cpu(link_tbl_ptr-len, cryptlen);
 
/* tag end of link table */
link_tbl_ptr-j_extent = DESC_PTR_LNKTBL_RETURN;


--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: remove duplicated include

2012-08-25 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

From: Wei Yongjun yongjun_...@trendmicro.com.cn

Remove duplicated include.

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/crypto/atmel-aes.c  | 5 -
 drivers/crypto/atmel-sha.c  | 5 -
 drivers/crypto/atmel-tdes.c | 5 -
 3 files changed, 15 deletions(-)

diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index 6bb20ff..fb81f87 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -24,15 +24,10 @@
 #include linux/platform_device.h
 
 #include linux/device.h
-#include linux/module.h
 #include linux/init.h
 #include linux/errno.h
 #include linux/interrupt.h
-#include linux/kernel.h
-#include linux/clk.h
 #include linux/irq.h
-#include linux/io.h
-#include linux/platform_device.h
 #include linux/scatterlist.h
 #include linux/dma-mapping.h
 #include linux/delay.h

diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index f938b9d..bcdf55f 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -24,15 +24,10 @@
 #include linux/platform_device.h
 
 #include linux/device.h
-#include linux/module.h
 #include linux/init.h
 #include linux/errno.h
 #include linux/interrupt.h
-#include linux/kernel.h
-#include linux/clk.h
 #include linux/irq.h
-#include linux/io.h
-#include linux/platform_device.h
 #include linux/scatterlist.h
 #include linux/dma-mapping.h
 #include linux/delay.h

diff --git a/drivers/crypto/atmel-tdes.c b/drivers/crypto/atmel-tdes.c
index eb2b61e..1f36365 100644
--- a/drivers/crypto/atmel-tdes.c
+++ b/drivers/crypto/atmel-tdes.c
@@ -24,15 +24,10 @@
 #include linux/platform_device.h
 
 #include linux/device.h
-#include linux/module.h
 #include linux/init.h
 #include linux/errno.h
 #include linux/interrupt.h
-#include linux/kernel.h
-#include linux/clk.h
 #include linux/irq.h
-#include linux/io.h
-#include linux/platform_device.h
 #include linux/scatterlist.h
 #include linux/dma-mapping.h
 #include linux/delay.h

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html