mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-05-02 18:17:50 -04:00
crypto: sahara - use dev_err_probe()
Switch to use dev_err_probe() to simplify the error paths and unify message template. While at it, also remove explicit error messages from every potential -ENOMEM. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
committed by
Herbert Xu
parent
2f8547af4b
commit
2548c7a908
@@ -1346,10 +1346,9 @@ static int sahara_probe(struct platform_device *pdev)
|
||||
|
||||
err = devm_request_irq(&pdev->dev, irq, sahara_irq_handler,
|
||||
0, dev_name(&pdev->dev), dev);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "failed to request irq\n");
|
||||
return err;
|
||||
}
|
||||
if (err)
|
||||
return dev_err_probe(&pdev->dev, err,
|
||||
"failed to request irq\n");
|
||||
|
||||
/* clocks */
|
||||
dev->clk_ipg = devm_clk_get_enabled(&pdev->dev, "ipg");
|
||||
@@ -1366,10 +1365,8 @@ static int sahara_probe(struct platform_device *pdev)
|
||||
dev->hw_desc[0] = dmam_alloc_coherent(&pdev->dev,
|
||||
SAHARA_MAX_HW_DESC * sizeof(struct sahara_hw_desc),
|
||||
&dev->hw_phys_desc[0], GFP_KERNEL);
|
||||
if (!dev->hw_desc[0]) {
|
||||
dev_err(&pdev->dev, "Could not allocate hw descriptors\n");
|
||||
if (!dev->hw_desc[0])
|
||||
return -ENOMEM;
|
||||
}
|
||||
dev->hw_desc[1] = dev->hw_desc[0] + 1;
|
||||
dev->hw_phys_desc[1] = dev->hw_phys_desc[0] +
|
||||
sizeof(struct sahara_hw_desc);
|
||||
@@ -1377,10 +1374,8 @@ static int sahara_probe(struct platform_device *pdev)
|
||||
/* Allocate space for iv and key */
|
||||
dev->key_base = dmam_alloc_coherent(&pdev->dev, 2 * AES_KEYSIZE_128,
|
||||
&dev->key_phys_base, GFP_KERNEL);
|
||||
if (!dev->key_base) {
|
||||
dev_err(&pdev->dev, "Could not allocate memory for key\n");
|
||||
if (!dev->key_base)
|
||||
return -ENOMEM;
|
||||
}
|
||||
dev->iv_base = dev->key_base + AES_KEYSIZE_128;
|
||||
dev->iv_phys_base = dev->key_phys_base + AES_KEYSIZE_128;
|
||||
|
||||
@@ -1388,19 +1383,15 @@ static int sahara_probe(struct platform_device *pdev)
|
||||
dev->context_base = dmam_alloc_coherent(&pdev->dev,
|
||||
SHA256_DIGEST_SIZE + 4,
|
||||
&dev->context_phys_base, GFP_KERNEL);
|
||||
if (!dev->context_base) {
|
||||
dev_err(&pdev->dev, "Could not allocate memory for MDHA context\n");
|
||||
if (!dev->context_base)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Allocate space for HW links */
|
||||
dev->hw_link[0] = dmam_alloc_coherent(&pdev->dev,
|
||||
SAHARA_MAX_HW_LINK * sizeof(struct sahara_hw_link),
|
||||
&dev->hw_phys_link[0], GFP_KERNEL);
|
||||
if (!dev->hw_link[0]) {
|
||||
dev_err(&pdev->dev, "Could not allocate hw links\n");
|
||||
if (!dev->hw_link[0])
|
||||
return -ENOMEM;
|
||||
}
|
||||
for (i = 1; i < SAHARA_MAX_HW_LINK; i++) {
|
||||
dev->hw_phys_link[i] = dev->hw_phys_link[i - 1] +
|
||||
sizeof(struct sahara_hw_link);
|
||||
@@ -1431,8 +1422,8 @@ static int sahara_probe(struct platform_device *pdev)
|
||||
version = (version >> 8) & 0xff;
|
||||
}
|
||||
if (err == -ENODEV) {
|
||||
dev_err(&pdev->dev, "SAHARA version %d not supported\n",
|
||||
version);
|
||||
dev_err_probe(&pdev->dev, err,
|
||||
"SAHARA version %d not supported\n", version);
|
||||
goto err_algs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user