]> git.karo-electronics.de Git - linux-beck.git/commitdiff
crypto: mv_cesa - Use resource_size
authorTobias Klauser <tklauser@distanz.ch>
Fri, 14 May 2010 04:58:05 +0000 (14:58 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 May 2010 04:58:05 +0000 (14:58 +1000)
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>
drivers/crypto/mv_cesa.c

index 18a436cafc107f1004cb4686e7ca8946d2f8f2d2..e095422b58ddbd44ab3c82985fd5ed47e288b918 100644 (file)
@@ -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;
@@ -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) {