Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1898066ybt; Mon, 15 Jun 2020 12:16:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIs0QKON0oQeipD0z7REtzVhoUKtl8IJF3N0vDRsLqiaGKpbzbm5VXeG19gCn9WnnRnsCW X-Received: by 2002:a17:906:2e55:: with SMTP id r21mr13971514eji.338.1592248618342; Mon, 15 Jun 2020 12:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592248618; cv=none; d=google.com; s=arc-20160816; b=nTFD7WfcYwBDxLvv8cxULgSUZ8p2wiY5vCsAf8HC7c58FgFy8gi/AKFhT4jVOoNKrd n24XzrZKonp7Ha5TCEdxKEjMDdh9g6UH0bfb3p9r4Tt8yTVd8Lk+XfFg5KzqfPXCH4ve 2Er75pM4e8zDTgbpFpFHmqkKhRII0ankVCaa729in6OS3Mc9kamDn94+13pvKtPDWT3z /iq8MVYfWvAI7iWAFVqzkltEsNsuQVph330RQooMrdLWgcfo/9ng42Aw7qENTHgBRqit Vhhap+27wtdN+/l+a9auzsz3lutowiybs6DEcX+F6GsadURKWILvo9F6jIhai1zq7Yxi Z/nA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=oJ5kL1rthBE8EM0JKRpanDQ3/7nK0MR9HBRq/0LaVYs=; b=L4Iz8pJoeTpt0btAQmVcAfVuPEUt2ymHuoYqxIz/rrw7MH9+rk0wpZF/T9DJUQ22RW FJdyXWFj/2e5YHEMwMoTWqc5XGiQb/CDGEfF2SalKeXpHO/mLNBKThRbcIomdBKvHn6Z +Dz/MBcYEgSh7ufMIVoaMEJIiaOy8JW2lTw+i8tF9OdFfClwF7oh7NEwhCC9P7iz6IcI ZJyw2KfSlWBViJatoNsV2BagDqSVbaTYCxzJ4qIeUZHmeAIU/ZMa7JHD9N9pzYGB7LbI snmJ9XV15Dv7Ibbk9AGPAAO+irh/CjsuVQonx0e2dxcVYNTEgmZD14h18luLc5XuacSW Ysog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gl8si10016621ejb.327.2020.06.15.12.16.35; Mon, 15 Jun 2020 12:16:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731329AbgFOTOp (ORCPT + 99 others); Mon, 15 Jun 2020 15:14:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:41944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731179AbgFOTOo (ORCPT ); Mon, 15 Jun 2020 15:14:44 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 40B9920739; Mon, 15 Jun 2020 19:14:44 +0000 (UTC) Date: Mon, 15 Jun 2020 15:14:42 -0400 From: Steven Rostedt To: Masami Hiramatsu Cc: stable@vger.kernel.org, LKML Subject: Re: [PATCH 3/4] tools/bootconfig: Fix to return 0 if succeeded to show the bootconfig Message-ID: <20200615151442.028c2876@oasis.local.home> In-Reply-To: <159197541534.80267.9851345208191438725.stgit@devnote2> References: <159197538852.80267.10091816844311950396.stgit@devnote2> <159197541534.80267.9851345208191438725.stgit@devnote2> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 13 Jun 2020 00:23:35 +0900 Masami Hiramatsu wrote: > Fix bootconfig to return 0 if succeeded to show the bootconfig > in initrd. Without this fix, "bootconfig INITRD" command > returns !0 even if the command succeeded to show the bootconfig. > > Fixes: 950313ebf79c ("tools: bootconfig: Add bootconfig command") > Cc: stable@vger.kernel.org > Signed-off-by: Masami Hiramatsu > --- > tools/bootconfig/main.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c > index 21896a6675fd..ff2cc9520e10 100644 > --- a/tools/bootconfig/main.c > +++ b/tools/bootconfig/main.c > @@ -209,8 +209,10 @@ int show_xbc(const char *path) > ret = load_xbc_from_initrd(fd, &buf); > if (ret < 0) > pr_err("Failed to load a boot config from initrd: %d\n", ret); > - else > + else { > xbc_show_compact_tree(); > + ret = 0; > + } Usually for the above, I think goto is cleaner. As it is strange to have a successful case as the "else" condition. Not to mention, if you add brackets for one side of the else, it is usually recommended to add them for the other side. But in this case I think it would read better to have: if (ret < 0) { pr_err(...); goto out; } xbc_show_compact_tree(); ret = 0; out: > > close(fd); > free(buf); -- Steve