fsl_law: Fix bug in calculation of LAW sizing
authorKumar Gala <galak@kernel.crashing.org>
Sat, 4 Apr 2009 15:21:02 +0000 (10:21 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Sat, 4 Apr 2009 15:21:40 +0000 (10:21 -0500)
In set_ddr_laws() when we determined how much of the size requested
to be mapped was covered by the the first LAW we needed to recalculate
the size based on what was actually mapped.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
drivers/misc/fsl_law.c

index be43a3ecf69fea1ab39cb5ffbc66d89d3ce798a1..f7d454dce457d75e4677fd0710c6b064cbabd44f 100644 (file)
@@ -139,6 +139,9 @@ int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id)
        if (set_last_law(start, law_sz_enc, id) < 0)
                return -1;
 
+       /* recalculate size based on what was actually covered by the law */
+       law_sz = 1ull << __ilog2_u64(law_sz);
+
        /* do we still have anything to map */
        sz = sz - law_sz;
        if (sz) {