All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: remapping too much memory
@ 2017-06-28 11:49 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2017-06-28 11:49 UTC (permalink / raw)
  To: Scott Wood
  Cc: Kumar Gala, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, linuxppc-dev, kernel-janitors

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 <dan.carpenter@oracle.com>

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;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] powerpc: remapping too much memory
@ 2017-06-28 11:49 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2017-06-28 11:49 UTC (permalink / raw)
  To: Scott Wood
  Cc: Kumar Gala, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, linuxppc-dev, kernel-janitors

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 <dan.carpenter@oracle.com>

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;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc: remapping too much memory
  2017-06-28 11:49 ` Dan Carpenter
@ 2017-06-29  5:26   ` Michael Ellerman
  -1 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2017-06-29  5:26 UTC (permalink / raw)
  To: Dan Carpenter, Scott Wood
  Cc: Kumar Gala, Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc: remapping too much memory
@ 2017-06-29  5:26   ` Michael Ellerman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2017-06-29  5:26 UTC (permalink / raw)
  To: Dan Carpenter, Scott Wood
  Cc: Kumar Gala, Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: powerpc: remapping too much memory
  2017-06-28 11:49 ` Dan Carpenter
@ 2017-08-31 11:36   ` Michael Ellerman
  -1 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2017-08-31 11:36 UTC (permalink / raw)
  To: Dan Carpenter, Scott Wood; +Cc: kernel-janitors, Paul Mackerras, linuxppc-dev

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 <dan.carpenter@oracle.com>

Applied to powerpc next, thanks.

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

cheers

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: powerpc: remapping too much memory
@ 2017-08-31 11:36   ` Michael Ellerman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2017-08-31 11:36 UTC (permalink / raw)
  To: Dan Carpenter, Scott Wood; +Cc: kernel-janitors, Paul Mackerras, linuxppc-dev

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 <dan.carpenter@oracle.com>

Applied to powerpc next, thanks.

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

cheers

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-08-31 11:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 11:49 [PATCH] powerpc: remapping too much memory Dan Carpenter
2017-06-28 11:49 ` Dan Carpenter
2017-06-29  5:26 ` Michael Ellerman
2017-06-29  5:26   ` Michael Ellerman
2017-08-31 11:36 ` Michael Ellerman
2017-08-31 11:36   ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.