Commit 90933f3f authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Greg Kroah-Hartman

crypto: atmel - fix checks of error code returned by devm_ioremap_resource()

commit 9b52d55f upstream.

The change fixes potential oops while accessing iomem on invalid
address, if devm_ioremap_resource() fails due to some reason.

The devm_ioremap_resource() function returns ERR_PTR() and never
returns NULL, which makes useless a following check for NULL.
Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Fixes: b0e8b341 ("crypto: atmel - use devm_xxx() managed function")
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f69c1b51
...@@ -1396,9 +1396,9 @@ static int atmel_aes_probe(struct platform_device *pdev) ...@@ -1396,9 +1396,9 @@ static int atmel_aes_probe(struct platform_device *pdev)
} }
aes_dd->io_base = devm_ioremap_resource(&pdev->dev, aes_res); aes_dd->io_base = devm_ioremap_resource(&pdev->dev, aes_res);
if (!aes_dd->io_base) { if (IS_ERR(aes_dd->io_base)) {
dev_err(dev, "can't ioremap\n"); dev_err(dev, "can't ioremap\n");
err = -ENOMEM; err = PTR_ERR(aes_dd->io_base);
goto res_err; goto res_err;
} }
......
...@@ -1405,9 +1405,9 @@ static int atmel_sha_probe(struct platform_device *pdev) ...@@ -1405,9 +1405,9 @@ static int atmel_sha_probe(struct platform_device *pdev)
} }
sha_dd->io_base = devm_ioremap_resource(&pdev->dev, sha_res); sha_dd->io_base = devm_ioremap_resource(&pdev->dev, sha_res);
if (!sha_dd->io_base) { if (IS_ERR(sha_dd->io_base)) {
dev_err(dev, "can't ioremap\n"); dev_err(dev, "can't ioremap\n");
err = -ENOMEM; err = PTR_ERR(sha_dd->io_base);
goto res_err; goto res_err;
} }
......
...@@ -1417,9 +1417,9 @@ static int atmel_tdes_probe(struct platform_device *pdev) ...@@ -1417,9 +1417,9 @@ static int atmel_tdes_probe(struct platform_device *pdev)
} }
tdes_dd->io_base = devm_ioremap_resource(&pdev->dev, tdes_res); tdes_dd->io_base = devm_ioremap_resource(&pdev->dev, tdes_res);
if (!tdes_dd->io_base) { if (IS_ERR(tdes_dd->io_base)) {
dev_err(dev, "can't ioremap\n"); dev_err(dev, "can't ioremap\n");
err = -ENOMEM; err = PTR_ERR(tdes_dd->io_base);
goto res_err; goto res_err;
} }
......
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