Skip to content

Commit

Permalink
crypto: mv_cesa - Use resource_size
Browse files Browse the repository at this point in the history
Use the resource_size function instead of manually calculating the
resource size. This reduces the chance of introducing off-by-one errors.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Tobias Klauser authored and Herbert Xu committed May 14, 2010
1 parent edc774e commit 5bdd5de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/crypto/mv_cesa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ static int mv_probe(struct platform_device *pdev)

spin_lock_init(&cp->lock);
crypto_init_queue(&cp->queue, 50);
cp->reg = ioremap(res->start, res->end - res->start + 1);
cp->reg = ioremap(res->start, resource_size(res));
if (!cp->reg) {
ret = -ENOMEM;
goto err;
Expand All @@ -1034,7 +1034,7 @@ static int mv_probe(struct platform_device *pdev)
ret = -ENXIO;
goto err_unmap_reg;
}
cp->sram_size = res->end - res->start + 1;
cp->sram_size = resource_size(res);
cp->max_req_size = cp->sram_size - SRAM_CFG_SPACE;
cp->sram = ioremap(res->start, cp->sram_size);
if (!cp->sram) {
Expand Down

0 comments on commit 5bdd5de

Please sign in to comment.