Commit dac0bde4 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

Pull crypto fixes from Herbert Xu:
 "This fixes a bug in the newly added Exynos5433 AES code as well as an
  old one in the caam driver"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: caam - add missing put_device() call
  crypto: s5p-sss - fix AES support for Exynos5433
parents 5ea6718b 00e87449
...@@ -3455,7 +3455,6 @@ static int __init caam_algapi_init(void) ...@@ -3455,7 +3455,6 @@ static int __init caam_algapi_init(void)
{ {
struct device_node *dev_node; struct device_node *dev_node;
struct platform_device *pdev; struct platform_device *pdev;
struct device *ctrldev;
struct caam_drv_private *priv; struct caam_drv_private *priv;
int i = 0, err = 0; int i = 0, err = 0;
u32 aes_vid, aes_inst, des_inst, md_vid, md_inst, ccha_inst, ptha_inst; u32 aes_vid, aes_inst, des_inst, md_vid, md_inst, ccha_inst, ptha_inst;
...@@ -3476,16 +3475,17 @@ static int __init caam_algapi_init(void) ...@@ -3476,16 +3475,17 @@ static int __init caam_algapi_init(void)
return -ENODEV; return -ENODEV;
} }
ctrldev = &pdev->dev; priv = dev_get_drvdata(&pdev->dev);
priv = dev_get_drvdata(ctrldev);
of_node_put(dev_node); of_node_put(dev_node);
/* /*
* If priv is NULL, it's probably because the caam driver wasn't * If priv is NULL, it's probably because the caam driver wasn't
* properly initialized (e.g. RNG4 init failed). Thus, bail out here. * properly initialized (e.g. RNG4 init failed). Thus, bail out here.
*/ */
if (!priv) if (!priv) {
return -ENODEV; err = -ENODEV;
goto out_put_dev;
}
/* /*
...@@ -3626,6 +3626,8 @@ static int __init caam_algapi_init(void) ...@@ -3626,6 +3626,8 @@ static int __init caam_algapi_init(void)
if (registered) if (registered)
pr_info("caam algorithms registered in /proc/crypto\n"); pr_info("caam algorithms registered in /proc/crypto\n");
out_put_dev:
put_device(&pdev->dev);
return err; return err;
} }
......
...@@ -2492,12 +2492,15 @@ static int __init caam_qi_algapi_init(void) ...@@ -2492,12 +2492,15 @@ static int __init caam_qi_algapi_init(void)
* If priv is NULL, it's probably because the caam driver wasn't * If priv is NULL, it's probably because the caam driver wasn't
* properly initialized (e.g. RNG4 init failed). Thus, bail out here. * properly initialized (e.g. RNG4 init failed). Thus, bail out here.
*/ */
if (!priv || !priv->qi_present) if (!priv || !priv->qi_present) {
return -ENODEV; err = -ENODEV;
goto out_put_dev;
}
if (caam_dpaa2) { if (caam_dpaa2) {
dev_info(ctrldev, "caam/qi frontend driver not suitable for DPAA 2.x, aborting...\n"); dev_info(ctrldev, "caam/qi frontend driver not suitable for DPAA 2.x, aborting...\n");
return -ENODEV; err = -ENODEV;
goto out_put_dev;
} }
/* /*
...@@ -2610,6 +2613,8 @@ static int __init caam_qi_algapi_init(void) ...@@ -2610,6 +2613,8 @@ static int __init caam_qi_algapi_init(void)
if (registered) if (registered)
dev_info(priv->qidev, "algorithms registered in /proc/crypto\n"); dev_info(priv->qidev, "algorithms registered in /proc/crypto\n");
out_put_dev:
put_device(ctrldev);
return err; return err;
} }
......
...@@ -1993,7 +1993,6 @@ static int __init caam_algapi_hash_init(void) ...@@ -1993,7 +1993,6 @@ static int __init caam_algapi_hash_init(void)
{ {
struct device_node *dev_node; struct device_node *dev_node;
struct platform_device *pdev; struct platform_device *pdev;
struct device *ctrldev;
int i = 0, err = 0; int i = 0, err = 0;
struct caam_drv_private *priv; struct caam_drv_private *priv;
unsigned int md_limit = SHA512_DIGEST_SIZE; unsigned int md_limit = SHA512_DIGEST_SIZE;
...@@ -2012,16 +2011,17 @@ static int __init caam_algapi_hash_init(void) ...@@ -2012,16 +2011,17 @@ static int __init caam_algapi_hash_init(void)
return -ENODEV; return -ENODEV;
} }
ctrldev = &pdev->dev; priv = dev_get_drvdata(&pdev->dev);
priv = dev_get_drvdata(ctrldev);
of_node_put(dev_node); of_node_put(dev_node);
/* /*
* If priv is NULL, it's probably because the caam driver wasn't * If priv is NULL, it's probably because the caam driver wasn't
* properly initialized (e.g. RNG4 init failed). Thus, bail out here. * properly initialized (e.g. RNG4 init failed). Thus, bail out here.
*/ */
if (!priv) if (!priv) {
return -ENODEV; err = -ENODEV;
goto out_put_dev;
}
/* /*
* Register crypto algorithms the device supports. First, identify * Register crypto algorithms the device supports. First, identify
...@@ -2043,8 +2043,10 @@ static int __init caam_algapi_hash_init(void) ...@@ -2043,8 +2043,10 @@ static int __init caam_algapi_hash_init(void)
* Skip registration of any hashing algorithms if MD block * Skip registration of any hashing algorithms if MD block
* is not present. * is not present.
*/ */
if (!md_inst) if (!md_inst) {
return -ENODEV; err = -ENODEV;
goto out_put_dev;
}
/* Limit digest size based on LP256 */ /* Limit digest size based on LP256 */
if (md_vid == CHA_VER_VID_MD_LP256) if (md_vid == CHA_VER_VID_MD_LP256)
...@@ -2101,6 +2103,8 @@ static int __init caam_algapi_hash_init(void) ...@@ -2101,6 +2103,8 @@ static int __init caam_algapi_hash_init(void)
list_add_tail(&t_alg->entry, &hash_list); list_add_tail(&t_alg->entry, &hash_list);
} }
out_put_dev:
put_device(&pdev->dev);
return err; return err;
} }
......
...@@ -1042,8 +1042,10 @@ static int __init caam_pkc_init(void) ...@@ -1042,8 +1042,10 @@ static int __init caam_pkc_init(void)
* If priv is NULL, it's probably because the caam driver wasn't * If priv is NULL, it's probably because the caam driver wasn't
* properly initialized (e.g. RNG4 init failed). Thus, bail out here. * properly initialized (e.g. RNG4 init failed). Thus, bail out here.
*/ */
if (!priv) if (!priv) {
return -ENODEV; err = -ENODEV;
goto out_put_dev;
}
/* Determine public key hardware accelerator presence. */ /* Determine public key hardware accelerator presence. */
if (priv->era < 10) if (priv->era < 10)
...@@ -1053,8 +1055,10 @@ static int __init caam_pkc_init(void) ...@@ -1053,8 +1055,10 @@ static int __init caam_pkc_init(void)
pk_inst = rd_reg32(&priv->ctrl->vreg.pkha) & CHA_VER_NUM_MASK; pk_inst = rd_reg32(&priv->ctrl->vreg.pkha) & CHA_VER_NUM_MASK;
/* Do not register algorithms if PKHA is not present. */ /* Do not register algorithms if PKHA is not present. */
if (!pk_inst) if (!pk_inst) {
return -ENODEV; err = -ENODEV;
goto out_put_dev;
}
err = crypto_register_akcipher(&caam_rsa); err = crypto_register_akcipher(&caam_rsa);
if (err) if (err)
...@@ -1063,6 +1067,8 @@ static int __init caam_pkc_init(void) ...@@ -1063,6 +1067,8 @@ static int __init caam_pkc_init(void)
else else
dev_info(ctrldev, "caam pkc algorithms registered in /proc/crypto\n"); dev_info(ctrldev, "caam pkc algorithms registered in /proc/crypto\n");
out_put_dev:
put_device(ctrldev);
return err; return err;
} }
......
...@@ -308,7 +308,6 @@ static int __init caam_rng_init(void) ...@@ -308,7 +308,6 @@ static int __init caam_rng_init(void)
struct device *dev; struct device *dev;
struct device_node *dev_node; struct device_node *dev_node;
struct platform_device *pdev; struct platform_device *pdev;
struct device *ctrldev;
struct caam_drv_private *priv; struct caam_drv_private *priv;
u32 rng_inst; u32 rng_inst;
int err; int err;
...@@ -326,16 +325,17 @@ static int __init caam_rng_init(void) ...@@ -326,16 +325,17 @@ static int __init caam_rng_init(void)
return -ENODEV; return -ENODEV;
} }
ctrldev = &pdev->dev; priv = dev_get_drvdata(&pdev->dev);
priv = dev_get_drvdata(ctrldev);
of_node_put(dev_node); of_node_put(dev_node);
/* /*
* If priv is NULL, it's probably because the caam driver wasn't * If priv is NULL, it's probably because the caam driver wasn't
* properly initialized (e.g. RNG4 init failed). Thus, bail out here. * properly initialized (e.g. RNG4 init failed). Thus, bail out here.
*/ */
if (!priv) if (!priv) {
return -ENODEV; err = -ENODEV;
goto out_put_dev;
}
/* Check for an instantiated RNG before registration */ /* Check for an instantiated RNG before registration */
if (priv->era < 10) if (priv->era < 10)
...@@ -344,13 +344,16 @@ static int __init caam_rng_init(void) ...@@ -344,13 +344,16 @@ static int __init caam_rng_init(void)
else else
rng_inst = rd_reg32(&priv->ctrl->vreg.rng) & CHA_VER_NUM_MASK; rng_inst = rd_reg32(&priv->ctrl->vreg.rng) & CHA_VER_NUM_MASK;
if (!rng_inst) if (!rng_inst) {
return -ENODEV; err = -ENODEV;
goto out_put_dev;
}
dev = caam_jr_alloc(); dev = caam_jr_alloc();
if (IS_ERR(dev)) { if (IS_ERR(dev)) {
pr_err("Job Ring Device allocation for transform failed\n"); pr_err("Job Ring Device allocation for transform failed\n");
return PTR_ERR(dev); err = PTR_ERR(dev);
goto out_put_dev;
} }
rng_ctx = kmalloc(sizeof(*rng_ctx), GFP_DMA | GFP_KERNEL); rng_ctx = kmalloc(sizeof(*rng_ctx), GFP_DMA | GFP_KERNEL);
if (!rng_ctx) { if (!rng_ctx) {
...@@ -361,6 +364,7 @@ static int __init caam_rng_init(void) ...@@ -361,6 +364,7 @@ static int __init caam_rng_init(void)
if (err) if (err)
goto free_rng_ctx; goto free_rng_ctx;
put_device(&pdev->dev);
dev_info(dev, "registering rng-caam\n"); dev_info(dev, "registering rng-caam\n");
return hwrng_register(&caam_rng); return hwrng_register(&caam_rng);
...@@ -368,6 +372,8 @@ static int __init caam_rng_init(void) ...@@ -368,6 +372,8 @@ static int __init caam_rng_init(void)
kfree(rng_ctx); kfree(rng_ctx);
free_caam_alloc: free_caam_alloc:
caam_jr_free(dev); caam_jr_free(dev);
out_put_dev:
put_device(&pdev->dev);
return err; return err;
} }
......
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
struct samsung_aes_variant { struct samsung_aes_variant {
unsigned int aes_offset; unsigned int aes_offset;
unsigned int hash_offset; unsigned int hash_offset;
const char *clk_names[]; const char *clk_names[2];
}; };
struct s5p_aes_reqctx { struct s5p_aes_reqctx {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment