From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752484AbbCSKfN (ORCPT ); Thu, 19 Mar 2015 06:35:13 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54656 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbbCSKfJ (ORCPT ); Thu, 19 Mar 2015 06:35:09 -0400 Date: Thu, 19 Mar 2015 11:33:30 +0100 From: Borislav Petkov To: Xie XiuQi 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 Message-ID: <20150319103330.GC11544@pd.tnic> References: <1426755004-28434-1-git-send-email-xiexiuqi@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1426755004-28434-1-git-send-email-xiexiuqi@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; ^ --- 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 -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --