Skip to content

Commit

Permalink
crypto: ux500 - 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: 5a4eea2 ("crypto: ux500 - 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 9b52d55 commit b62917a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/crypto/ux500/cryp/cryp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1440,9 +1440,9 @@ static int ux500_cryp_probe(struct platform_device *pdev)

device_data->phybase = res->start;
device_data->base = devm_ioremap_resource(dev, res);
if (!device_data->base) {
if (IS_ERR(device_data->base)) {
dev_err(dev, "[%s]: ioremap failed!", __func__);
ret = -ENOMEM;
ret = PTR_ERR(device_data->base);
goto out;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/crypto/ux500/hash/hash_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1659,9 +1659,9 @@ static int ux500_hash_probe(struct platform_device *pdev)

device_data->phybase = res->start;
device_data->base = devm_ioremap_resource(dev, res);
if (!device_data->base) {
if (IS_ERR(device_data->base)) {
dev_err(dev, "%s: ioremap() failed!\n", __func__);
ret = -ENOMEM;
ret = PTR_ERR(device_data->base);
goto out;
}
spin_lock_init(&device_data->ctx_lock);
Expand Down

0 comments on commit b62917a

Please sign in to comment.