All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xie XiuQi <xiexiuqi@huawei.com>
To: Borislav Petkov <bp@suse.de>
Cc: <akpm@linux-foundation.org>, <n-horiguchi@ah.jp.nec.com>,
	<rostedt@goodmis.org>, <gong.chen@linux.intel.com>,
	<bhelgaas@google.com>, <tony.luck@intel.com>,
	<linux-kernel@vger.kernel.org>, <jingle.chen@huawei.com>
Subject: Re: [PATCH] trace, RAS: remove unnecessary const
Date: Thu, 19 Mar 2015 19:57:17 +0800	[thread overview]
Message-ID: <550AB99D.5010006@huawei.com> (raw)
In-Reply-To: <20150319103330.GC11544@pd.tnic>

On 2015/3/19 18:33, Borislav Petkov wrote:
> On Thu, Mar 19, 2015 at 04:50:04PM +0800, Xie XiuQi wrote:
>> These parameters are passed by value. There's no need to make them const.
> 
> I can think of a reason:
> 
> include/trace/../../include/ras/ras_event.h: In function ‘ftrace_raw_event_mc_event’:
> include/trace/../../include/ras/ras_event.h:136:35: error: assignment of read-only parameter ‘top_layer’
>    __entry->top_layer  = top_layer = 12;

Oh, indeed. Thanks, Boris!

>                                    ^
> ---
> diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
> index 79abb9c71772..e4721eac3e25 100644
> --- a/include/ras/ras_event.h
> +++ b/include/ras/ras_event.h
> @@ -133,7 +133,7 @@ TRACE_EVENT(mc_event,
>                 __assign_str(label, label);
>                 __entry->error_count            = error_count;
>                 __entry->mc_index               = mc_index;
> -               __entry->top_layer              = top_layer;
> +               __entry->top_layer              = top_layer = 12;
>                 __entry->middle_layer           = mid_layer;
>                 __entry->lower_layer            = low_layer;
>                 __entry->address                = address;
> ---
> 
> I'm not saying it is a particularly sane reason and no one would even
> *think* of changing TP parameters passed on from higher layers in the TP
> itself but I've seen people do lotsa crazy things - things they normally
> would never do - so if it doesn't hurt having the const here, what's the
> downside of having the compiler do that sanity checking for us too?
> 
> Steve, this is an invitation for your crazy fantasy! :-P
> 



  reply	other threads:[~2015-03-19 11:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19  8:50 [PATCH] trace, RAS: remove unnecessary const Xie XiuQi
2015-03-19 10:33 ` Borislav Petkov
2015-03-19 11:57   ` Xie XiuQi [this message]
2015-03-19 13:00     ` Steven Rostedt
2015-03-20  4:05       ` Xie XiuQi
2015-03-19 12:57   ` Steven Rostedt
2015-03-19 13:10     ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=550AB99D.5010006@huawei.com \
    --to=xiexiuqi@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhelgaas@google.com \
    --cc=bp@suse.de \
    --cc=gong.chen@linux.intel.com \
    --cc=jingle.chen@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=rostedt@goodmis.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.