Skip to content

Commit

Permalink
crypto: atmel - fix checks of error code returned by devm_ioremap_res…
Browse files Browse the repository at this point in the history
…ource()

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: Vladimir Zapolskiy <vz@mleia.com>
Fixes: b0e8b34 ("crypto: atmel - use devm_xxx() managed function")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Vladimir Zapolskiy authored and Herbert Xu committed Mar 11, 2016
1 parent 84a0ced commit 9b52d55
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions drivers/crypto/atmel-aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2079,9 +2079,9 @@ static int atmel_aes_probe(struct platform_device *pdev)
}

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");
err = -ENOMEM;
err = PTR_ERR(aes_dd->io_base);
goto res_err;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/crypto/atmel-sha.c
Original file line number Diff line number Diff line change
Expand Up @@ -1486,9 +1486,9 @@ static int atmel_sha_probe(struct platform_device *pdev)
}

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");
err = -ENOMEM;
err = PTR_ERR(sha_dd->io_base);
goto res_err;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/crypto/atmel-tdes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,9 +1417,9 @@ static int atmel_tdes_probe(struct platform_device *pdev)
}

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");
err = -ENOMEM;
err = PTR_ERR(tdes_dd->io_base);
goto res_err;
}

Expand Down

0 comments on commit 9b52d55

Please sign in to comment.