Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1552302imu; Mon, 5 Nov 2018 23:59:33 -0800 (PST) X-Google-Smtp-Source: AJdET5fG0vbjuRhDQMIq0mB2Kzc3L1IYzJyp0WtpsWK/d813Ws7H9m7UV8w8YO4M6SFWXTIcDoAO X-Received: by 2002:a63:164d:: with SMTP id 13-v6mr22957589pgw.103.1541491173499; Mon, 05 Nov 2018 23:59:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541491173; cv=none; d=google.com; s=arc-20160816; b=i2HG+AbF1AmNYgu0aRBMgn15fsS7tTPBByJ5itESgLReKrdsNifgETFIykr/wUCL8+ p3av+cJ4oaalYWCnRd/Xi8aaM+yn+QHGeh+sIO24vbBgcTUfpAkY164Etysj32I95m9I lXS1K24I8v6aa5Kcv7gjbZZ+V7GAk8MtdBrVJBQZafvFIzRmFZsJ9qyAFCZtRn49BUeJ CBQhgya3Fwx+IFmYB9A+y/DSH55JjUHg5YVYJ5IWlZH7HS1BiifDiiKF/pzb2DB8+lhb gpl7Q0ty7w9yzw6PLeuiNBCBejCNSK0PhiKLUo1xDoZj5jsmP0Q6Gmy9+GFqm4kJCoe+ 50Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=5kETjXR60zMvtNGbu4KBaN1bG100Sq9cFKmE8w3fnuE=; b=PzS82dKudkbl0lr4F2FTumUYpkugYSLR1XQ0+VrUAxAB34BfPfvtPJozXolun6GFx1 vGEGsEsz7lFChnsYIKokANWJ4sqxPVTCgBGUMXAW8HrE5JB11hakAOS3TzL2pYI92d/B v0trsZ97mNpwyV3jE7vk5/3bCCO5LTJOI987MiDbRmNG4+3rWgbyOA378SKUxX3/O/Rj vtCouK4wwta6QVmGlYkKVeInMveap0uJsrmzIVAagWUTe/3fHz9Ue/Q+gGf+Bp0fmwS1 0/XuUGU2FJzI0x6Afu2xDh3Bsf81x/u3ZIopLJ3fZK7LTdK0qwAzObeicxEoPeJzhoyZ HIDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4-v6si35354639pgi.348.2018.11.05.23.59.16; Mon, 05 Nov 2018 23:59:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387407AbeKFRWx (ORCPT + 99 others); Tue, 6 Nov 2018 12:22:53 -0500 Received: from smtprelay0234.hostedemail.com ([216.40.44.234]:48321 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729021AbeKFRWw (ORCPT ); Tue, 6 Nov 2018 12:22:52 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id BD69618029585; Tue, 6 Nov 2018 07:58:53 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1543:1593:1594:1711:1730:1747:1777:1792:1801:2196:2198:2199:2200:2393:2553:2559:2562:2731:2828:3138:3139:3140:3141:3142:3355:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:4385:4605:5007:6119:7514:7903:7904:10004:10400:10848:11026:11232:11658:11914:12043:12296:12438:12555:12740:12760:12895:13161:13229:13439:14093:14097:14181:14659:14721:21080:21433:21451:21627:30012:30054:30060:30070:30083:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:27,LUA_SUMMARY:none X-HE-Tag: owner79_1351625f00457 X-Filterd-Recvd-Size: 4032 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Tue, 6 Nov 2018 07:58:52 +0000 (UTC) Message-ID: <932e46a701ebe9b3b33a110d187880eda14c23fb.camel@perches.com> Subject: Re: [PATCH v2] kobject: to use pr_warn replace KERN_WARNING From: Joe Perches To: "Rafael J. Wysocki" , tsu.yubo@gmail.com Cc: Greg Kroah-Hartman , Linux Kernel Mailing List Date: Mon, 05 Nov 2018 23:58:51 -0800 In-Reply-To: References: <1541472103-6212-1-git-send-email-tsu.yubo@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-11-06 at 08:49 +0100, Rafael J. Wysocki wrote: > On Tue, Nov 6, 2018 at 3:42 AM Bo YU wrote: > > Fix warning form checkpatch, use pr_warn replace KERN_WARNING > > > > Signed-off-by: Bo YU > > First off, IMO, you should not change the existing code just in order > to make checkpatch happy about it. That alone is not a good enough > reason for modifying it. > > If the checkpatch warning indicates an issue like broken white space > (and I mean really broken and not lines longer than 80 chars etc), > then that may be a reason to modify the existing code, depending. Existing code is slightly broken. There is currently a missing terminating newline in the non-switch case match, when msg == NULL; It might be simpler to initialize msg like const char *msg = "failed to send uevent"; and always use msg and not msg ?: in the printk. > > changes in v2: > > According to Joe's suggestion,drop newline from msg, otherwise > > it can be unterminated with newline.ch > > --- > > lib/kobject_uevent.c | 11 ++++++----- > > 1 file changed, 6 insertions(+), 5 deletions(-) > > > > diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c > > index 63d0816ab23b..1837765ebf01 100644 > > --- a/lib/kobject_uevent.c > > +++ b/lib/kobject_uevent.c > > @@ -195,12 +195,12 @@ int kobject_synth_uevent(struct kobject *kobj, const char *buf, size_t count) > > enum kobject_action action; > > const char *action_args; > > struct kobj_uevent_env *env; > > - const char *msg = NULL, *devpath; > > + const char *msg = NULL; > > int r; > > > > r = kobject_action_type(buf, count, &action, &action_args); > > if (r) { > > - msg = "unknown uevent action string\n"; > > + msg = "unknown uevent action string"; > > goto out; > > } > > > > @@ -212,7 +212,7 @@ int kobject_synth_uevent(struct kobject *kobj, const char *buf, size_t count) > > r = kobject_action_args(action_args, > > count - (action_args - buf), &env); > > if (r == -EINVAL) { > > - msg = "incorrect uevent action arguments\n"; > > + msg = "incorrect uevent action arguments"; > > Second, this change is not what the changelog of your patch is talking about. > > > goto out; > > } > > > > @@ -223,8 +223,9 @@ int kobject_synth_uevent(struct kobject *kobj, const char *buf, size_t count) > > kfree(env); > > out: > > if (r) { > > - devpath = kobject_get_path(kobj, GFP_KERNEL); > > - printk(KERN_WARNING "synth uevent: %s: %s", > > + char *devpath = kobject_get_path(kobj, GFP_KERNEL); > > + > > + pr_warn("synth uevent: %s: %s\n", > > devpath ?: "unknown device", > > msg ?: "failed to send uevent"); > > kfree(devpath); > > -- > > 2.11.0 > >