Commit 2548c7a9 authored by Ovidiu Panait's avatar Ovidiu Panait Committed by Herbert Xu

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: default avatarOvidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 2f8547af
...@@ -1346,10 +1346,9 @@ static int sahara_probe(struct platform_device *pdev) ...@@ -1346,10 +1346,9 @@ static int sahara_probe(struct platform_device *pdev)
err = devm_request_irq(&pdev->dev, irq, sahara_irq_handler, err = devm_request_irq(&pdev->dev, irq, sahara_irq_handler,
0, dev_name(&pdev->dev), dev); 0, dev_name(&pdev->dev), dev);
if (err) { if (err)
dev_err(&pdev->dev, "failed to request irq\n"); return dev_err_probe(&pdev->dev, err,
return err; "failed to request irq\n");
}
/* clocks */ /* clocks */
dev->clk_ipg = devm_clk_get_enabled(&pdev->dev, "ipg"); dev->clk_ipg = devm_clk_get_enabled(&pdev->dev, "ipg");
...@@ -1366,10 +1365,8 @@ static int sahara_probe(struct platform_device *pdev) ...@@ -1366,10 +1365,8 @@ static int sahara_probe(struct platform_device *pdev)
dev->hw_desc[0] = dmam_alloc_coherent(&pdev->dev, dev->hw_desc[0] = dmam_alloc_coherent(&pdev->dev,
SAHARA_MAX_HW_DESC * sizeof(struct sahara_hw_desc), SAHARA_MAX_HW_DESC * sizeof(struct sahara_hw_desc),
&dev->hw_phys_desc[0], GFP_KERNEL); &dev->hw_phys_desc[0], GFP_KERNEL);
if (!dev->hw_desc[0]) { if (!dev->hw_desc[0])
dev_err(&pdev->dev, "Could not allocate hw descriptors\n");
return -ENOMEM; return -ENOMEM;
}
dev->hw_desc[1] = dev->hw_desc[0] + 1; dev->hw_desc[1] = dev->hw_desc[0] + 1;
dev->hw_phys_desc[1] = dev->hw_phys_desc[0] + dev->hw_phys_desc[1] = dev->hw_phys_desc[0] +
sizeof(struct sahara_hw_desc); sizeof(struct sahara_hw_desc);
...@@ -1377,10 +1374,8 @@ static int sahara_probe(struct platform_device *pdev) ...@@ -1377,10 +1374,8 @@ static int sahara_probe(struct platform_device *pdev)
/* Allocate space for iv and key */ /* Allocate space for iv and key */
dev->key_base = dmam_alloc_coherent(&pdev->dev, 2 * AES_KEYSIZE_128, dev->key_base = dmam_alloc_coherent(&pdev->dev, 2 * AES_KEYSIZE_128,
&dev->key_phys_base, GFP_KERNEL); &dev->key_phys_base, GFP_KERNEL);
if (!dev->key_base) { if (!dev->key_base)
dev_err(&pdev->dev, "Could not allocate memory for key\n");
return -ENOMEM; return -ENOMEM;
}
dev->iv_base = dev->key_base + AES_KEYSIZE_128; dev->iv_base = dev->key_base + AES_KEYSIZE_128;
dev->iv_phys_base = dev->key_phys_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) ...@@ -1388,19 +1383,15 @@ static int sahara_probe(struct platform_device *pdev)
dev->context_base = dmam_alloc_coherent(&pdev->dev, dev->context_base = dmam_alloc_coherent(&pdev->dev,
SHA256_DIGEST_SIZE + 4, SHA256_DIGEST_SIZE + 4,
&dev->context_phys_base, GFP_KERNEL); &dev->context_phys_base, GFP_KERNEL);
if (!dev->context_base) { if (!dev->context_base)
dev_err(&pdev->dev, "Could not allocate memory for MDHA context\n");
return -ENOMEM; return -ENOMEM;
}
/* Allocate space for HW links */ /* Allocate space for HW links */
dev->hw_link[0] = dmam_alloc_coherent(&pdev->dev, dev->hw_link[0] = dmam_alloc_coherent(&pdev->dev,
SAHARA_MAX_HW_LINK * sizeof(struct sahara_hw_link), SAHARA_MAX_HW_LINK * sizeof(struct sahara_hw_link),
&dev->hw_phys_link[0], GFP_KERNEL); &dev->hw_phys_link[0], GFP_KERNEL);
if (!dev->hw_link[0]) { if (!dev->hw_link[0])
dev_err(&pdev->dev, "Could not allocate hw links\n");
return -ENOMEM; return -ENOMEM;
}
for (i = 1; i < SAHARA_MAX_HW_LINK; i++) { for (i = 1; i < SAHARA_MAX_HW_LINK; i++) {
dev->hw_phys_link[i] = dev->hw_phys_link[i - 1] + dev->hw_phys_link[i] = dev->hw_phys_link[i - 1] +
sizeof(struct sahara_hw_link); sizeof(struct sahara_hw_link);
...@@ -1431,8 +1422,8 @@ static int sahara_probe(struct platform_device *pdev) ...@@ -1431,8 +1422,8 @@ static int sahara_probe(struct platform_device *pdev)
version = (version >> 8) & 0xff; version = (version >> 8) & 0xff;
} }
if (err == -ENODEV) { if (err == -ENODEV) {
dev_err(&pdev->dev, "SAHARA version %d not supported\n", dev_err_probe(&pdev->dev, err,
version); "SAHARA version %d not supported\n", version);
goto err_algs; goto err_algs;
} }
......
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