* [patch] arch/powerpc/platforms/pseries/ras.c - cleanup
@ 2010-03-08 21:06 Christophe Jaillet
2010-03-08 21:36 ` Julia Lawall
2010-03-09 10:44 ` Bernd Petrovitsch
0 siblings, 2 replies; 5+ messages in thread
From: Christophe Jaillet @ 2010-03-08 21:06 UTC (permalink / raw)
To: kernel-janitors
From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Hi, here is a patch against arch/powerpc/platforms/pseries/ras.c.
No need to memset (.., 0, ...) a buffer that is complety filled by a memcpy
the line after.
Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
---
diff --git a/arch/powerpc/platforms/pseries/ras.c
b/arch/powerpc/platforms/pseries/ras.c
index 2b548af..7a401ed 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -276,7 +276,6 @@ static struct rtas_error_log *fwnmi_get_errinfo(struct
pt_regs *regs)
(errdata >= rtas.base && errdata < rtas.base + rtas.size - 16)) {
savep = __va(errdata);
regs->gpr[3] = savep[0]; /* restore original r3 */
- memset(mce_data_buf, 0, RTAS_ERROR_LOG_MAX);
memcpy(mce_data_buf, (char *)(savep + 1), RTAS_ERROR_LOG_MAX);
errhdr = (struct rtas_error_log *)mce_data_buf;
} else {
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [patch] arch/powerpc/platforms/pseries/ras.c - cleanup
2010-03-08 21:06 [patch] arch/powerpc/platforms/pseries/ras.c - cleanup Christophe Jaillet
@ 2010-03-08 21:36 ` Julia Lawall
2010-03-09 6:14 ` Christophe Jaillet
2010-03-09 10:44 ` Bernd Petrovitsch
1 sibling, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2010-03-08 21:36 UTC (permalink / raw)
To: Christophe Jaillet; +Cc: kernel-janitors, linux-kernel
On Mon, 8 Mar 2010, Christophe Jaillet wrote:
> From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
>
> Hi, here is a patch against arch/powerpc/platforms/pseries/ras.c.
>
> No need to memset (.., 0, ...) a buffer that is complety filled by a memcpy
> the line after.
I find 14 occurrences of this in linux-next. Could it be useful for
something?
julia
>
>
> Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
>
> ---
>
> diff --git a/arch/powerpc/platforms/pseries/ras.c
> b/arch/powerpc/platforms/pseries/ras.c
> index 2b548af..7a401ed 100644
> --- a/arch/powerpc/platforms/pseries/ras.c
> +++ b/arch/powerpc/platforms/pseries/ras.c
> @@ -276,7 +276,6 @@ static struct rtas_error_log *fwnmi_get_errinfo(struct
> pt_regs *regs)
> (errdata >= rtas.base && errdata < rtas.base + rtas.size - 16)) {
> savep = __va(errdata);
> regs->gpr[3] = savep[0]; /* restore original r3 */
> - memset(mce_data_buf, 0, RTAS_ERROR_LOG_MAX);
> memcpy(mce_data_buf, (char *)(savep + 1), RTAS_ERROR_LOG_MAX);
> errhdr = (struct rtas_error_log *)mce_data_buf;
> } else {
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] arch/powerpc/platforms/pseries/ras.c - cleanup
2010-03-08 21:36 ` Julia Lawall
@ 2010-03-09 6:14 ` Christophe Jaillet
2010-03-09 17:21 ` Julia Lawall
0 siblings, 1 reply; 5+ messages in thread
From: Christophe Jaillet @ 2010-03-09 6:14 UTC (permalink / raw)
To: linux-kernel; +Cc: kernel-janitors
I personaly think that yes, because the smaller, the better.
Could you write one of your semantic match and send the patches ?
CJ
"Julia Lawall" <julia@diku.dk> a écrit dans le message de
news:Pine.LNX.4.64.1003082235030.5727@ask.diku.dk...
> On Mon, 8 Mar 2010, Christophe Jaillet wrote:
>
> > From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
> >
> > Hi, here is a patch against arch/powerpc/platforms/pseries/ras.c.
> >
> > No need to memset (.., 0, ...) a buffer that is complety filled by a
memcpy
> > the line after.
>
> I find 14 occurrences of this in linux-next. Could it be useful for
> something?
>
> julia
>
>
> >
> >
> > Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
> >
> > ---
> >
> > diff --git a/arch/powerpc/platforms/pseries/ras.c
> > b/arch/powerpc/platforms/pseries/ras.c
> > index 2b548af..7a401ed 100644
> > --- a/arch/powerpc/platforms/pseries/ras.c
> > +++ b/arch/powerpc/platforms/pseries/ras.c
> > @@ -276,7 +276,6 @@ static struct rtas_error_log
*fwnmi_get_errinfo(struct
> > pt_regs *regs)
> > (errdata >= rtas.base && errdata < rtas.base + rtas.size - 16)) {
> > savep = __va(errdata);
> > regs->gpr[3] = savep[0]; /* restore original r3 */
> > - memset(mce_data_buf, 0, RTAS_ERROR_LOG_MAX);
> > memcpy(mce_data_buf, (char *)(savep + 1), RTAS_ERROR_LOG_MAX);
> > errhdr = (struct rtas_error_log *)mce_data_buf;
> > } else {
> >
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe
kernel-janitors" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] arch/powerpc/platforms/pseries/ras.c - cleanup
2010-03-08 21:06 [patch] arch/powerpc/platforms/pseries/ras.c - cleanup Christophe Jaillet
2010-03-08 21:36 ` Julia Lawall
@ 2010-03-09 10:44 ` Bernd Petrovitsch
1 sibling, 0 replies; 5+ messages in thread
From: Bernd Petrovitsch @ 2010-03-09 10:44 UTC (permalink / raw)
To: kernel-janitors
On Mon, 2010-03-08 at 22:06 +0100, Christophe Jaillet wrote:
> From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
>
> Hi, here is a patch against arch/powerpc/platforms/pseries/ras.c.
>
> No need to memset (.., 0, ...) a buffer that is complety filled by a memcpy
> the line after.
>
>
> Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
>
> ---
>
> diff --git a/arch/powerpc/platforms/pseries/ras.c
> b/arch/powerpc/platforms/pseries/ras.c
> index 2b548af..7a401ed 100644
> --- a/arch/powerpc/platforms/pseries/ras.c
> +++ b/arch/powerpc/platforms/pseries/ras.c
> @@ -276,7 +276,6 @@ static struct rtas_error_log *fwnmi_get_errinfo(struct
> pt_regs *regs)
> (errdata >= rtas.base && errdata < rtas.base + rtas.size - 16)) {
> savep = __va(errdata);
> regs->gpr[3] = savep[0]; /* restore original r3 */
> - memset(mce_data_buf, 0, RTAS_ERROR_LOG_MAX);
> memcpy(mce_data_buf, (char *)(savep + 1), RTAS_ERROR_LOG_MAX);
While you are at it, this ^^^^^^^^ type cast is superfluous too.
> errhdr = (struct rtas_error_log *)mce_data_buf;
> } else {
Bernd
--
Bernd Petrovitsch Email : bernd@petrovitsch.priv.at
LUGA : http://www.luga.at
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] arch/powerpc/platforms/pseries/ras.c - cleanup
2010-03-09 6:14 ` Christophe Jaillet
@ 2010-03-09 17:21 ` Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2010-03-09 17:21 UTC (permalink / raw)
To: Christophe Jaillet; +Cc: kernel-janitors, linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2350 bytes --]
On Tue, 9 Mar 2010, Christophe Jaillet wrote:
> I personaly think that yes, because the smaller, the better.
Perhaps the memset solves some concurrency problem? I just wonder why
such a pattern would come up more than one time, in code that looks fairly
diverse (ie not copy-paste), if it really has no purpose. But I can
always send something and see what happens...
julia
> Could you write one of your semantic match and send the patches ?
>
> CJ
>
> "Julia Lawall" <julia@diku.dk> a écrit dans le message de
> news:Pine.LNX.4.64.1003082235030.5727@ask.diku.dk...
> > On Mon, 8 Mar 2010, Christophe Jaillet wrote:
> >
> > > From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
> > >
> > > Hi, here is a patch against arch/powerpc/platforms/pseries/ras.c.
> > >
> > > No need to memset (.., 0, ...) a buffer that is complety filled by a
> memcpy
> > > the line after.
> >
> > I find 14 occurrences of this in linux-next. Could it be useful for
> > something?
> >
> > julia
> >
> >
> > >
> > >
> > > Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
> > >
> > > ---
> > >
> > > diff --git a/arch/powerpc/platforms/pseries/ras.c
> > > b/arch/powerpc/platforms/pseries/ras.c
> > > index 2b548af..7a401ed 100644
> > > --- a/arch/powerpc/platforms/pseries/ras.c
> > > +++ b/arch/powerpc/platforms/pseries/ras.c
> > > @@ -276,7 +276,6 @@ static struct rtas_error_log
> *fwnmi_get_errinfo(struct
> > > pt_regs *regs)
> > > (errdata >= rtas.base && errdata < rtas.base + rtas.size - 16)) {
> > > savep = __va(errdata);
> > > regs->gpr[3] = savep[0]; /* restore original r3 */
> > > - memset(mce_data_buf, 0, RTAS_ERROR_LOG_MAX);
> > > memcpy(mce_data_buf, (char *)(savep + 1), RTAS_ERROR_LOG_MAX);
> > > errhdr = (struct rtas_error_log *)mce_data_buf;
> > > } else {
> > >
> > >
> > >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe
> kernel-janitors" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > >
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-03-09 17:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-08 21:06 [patch] arch/powerpc/platforms/pseries/ras.c - cleanup Christophe Jaillet
2010-03-08 21:36 ` Julia Lawall
2010-03-09 6:14 ` Christophe Jaillet
2010-03-09 17:21 ` Julia Lawall
2010-03-09 10:44 ` Bernd Petrovitsch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox