summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2023-07-21 11:54:44 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2023-07-28 13:20:25 +0300
commit81511798bdfb1a61f97569436789721aace942fb (patch)
tree08e4d81af4128d8a59a6fe04acef6ba0d3be5cae /drivers/char
parent5a3d66acf072ae78dfa06af712a42b24bef32c0f (diff)
downloadlinux-81511798bdfb1a61f97569436789721aace942fb.tar.xz
hwrng: cn10k - use dev_err_probe
Use dev_err_probe in error paths of the probe function, making the code a tiny bit simpler. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/cn10k-rng.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/char/hw_random/cn10k-rng.c b/drivers/char/hw_random/cn10k-rng.c
index 794ec77feb2c..31935316a160 100644
--- a/drivers/char/hw_random/cn10k-rng.c
+++ b/drivers/char/hw_random/cn10k-rng.c
@@ -187,10 +187,8 @@ static int cn10k_rng_probe(struct pci_dev *pdev, const struct pci_device_id *id)
pci_set_drvdata(pdev, rng);
rng->reg_base = pcim_iomap(pdev, 0, 0);
- if (!rng->reg_base) {
- dev_err(&pdev->dev, "Error while mapping CSRs, exiting\n");
- return -ENOMEM;
- }
+ if (!rng->reg_base)
+ return dev_err_probe(&pdev->dev, -ENOMEM, "Error while mapping CSRs, exiting\n");
rng->ops.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
"cn10k-rng-%s", dev_name(&pdev->dev));
@@ -205,10 +203,8 @@ static int cn10k_rng_probe(struct pci_dev *pdev, const struct pci_device_id *id)
reset_rng_health_state(rng);
err = devm_hwrng_register(&pdev->dev, &rng->ops);
- if (err) {
- dev_err(&pdev->dev, "Could not register hwrng device.\n");
- return err;
- }
+ if (err)
+ return dev_err_probe(&pdev->dev, err, "Could not register hwrng device.\n");
return 0;
}