[PATCH] powerpc: remapping too much memory

Subsystems: linux for powerpc (32-bit and 64-bit), linux for powerpc embedded ppc8xx and ppc83xx, the rest

STALE3262d

3 messages, 3 authors, 2017-08-31 · open the first message on its own page

[PATCH] powerpc: remapping too much memory

From: Dan Carpenter <hidden>
Date: 2017-06-28 11:49:47

There is a cut and paste error here so we use "sizeof(struct mpc83xx_pmc)"
to remap the memory for "clock_regs".  That sizeof() is 20 bytes and we
only need to remap 12 bytes.  It presumably doesn't affect run time too
much...

I changed them to both use "sizeof(*variable_name)" because that's the
prefered kernel style these days.

Fixes: d49747bdfb2d ("powerpc/mpc83xx: Power Management support")
Signed-off-by: Dan Carpenter <redacted>
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 978b85bb3233..7fa3e197871a 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -361,7 +361,7 @@ static int pmc_probe(struct platform_device *ofdev)
 			return -EBUSY;
 	}
 
-	pmc_regs = ioremap(res.start, sizeof(struct mpc83xx_pmc));
+	pmc_regs = ioremap(res.start, sizeof(*pmc_regs));
 
 	if (!pmc_regs) {
 		ret = -ENOMEM;
@@ -374,7 +374,7 @@ static int pmc_probe(struct platform_device *ofdev)
 		goto out_pmc;
 	}
 
-	clock_regs = ioremap(res.start, sizeof(struct mpc83xx_pmc));
+	clock_regs = ioremap(res.start, sizeof(*clock_regs));
 
 	if (!clock_regs) {
 		ret = -ENOMEM;

Re: [PATCH] powerpc: remapping too much memory

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2017-06-29 05:26:15

Dan Carpenter [off-list ref] writes:
There is a cut and paste error here so we use "sizeof(struct mpc83xx_pmc)"
to remap the memory for "clock_regs".  That sizeof() is 20 bytes and we
only need to remap 12 bytes.  It presumably doesn't affect run time too
much...
I don't know 83xx well, but I suspect mappings occur on a 4K granularity
at a minimum :)
I changed them to both use "sizeof(*variable_name)" because that's the
prefered kernel style these days.
Thanks.

cheers

Re: powerpc: remapping too much memory

From: Michael Ellerman <hidden>
Date: 2017-08-31 11:36:05

On Wed, 2017-06-28 at 11:49:07 UTC, Dan Carpenter wrote:
There is a cut and paste error here so we use "sizeof(struct mpc83xx_pmc)"
to remap the memory for "clock_regs".  That sizeof() is 20 bytes and we
only need to remap 12 bytes.  It presumably doesn't affect run time too
much...

I changed them to both use "sizeof(*variable_name)" because that's the
prefered kernel style these days.

Fixes: d49747bdfb2d ("powerpc/mpc83xx: Power Management support")
Signed-off-by: Dan Carpenter <redacted>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/c65540453e150844367ffe98e45d51

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help