From: Jiri Slaby <jirislaby@kernel.org>
To: Wan Jiabing <wanjiabing@vivo.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: kael_w@yeah.net
Subject: Re: [PATCH] tty/hvc_opal: simplify if-if to if-else
Date: Mon, 25 Apr 2022 07:57:40 +0200 [thread overview]
Message-ID: <2c1e137b-9866-4f6b-1413-0adaa8fdd57b@kernel.org> (raw)
In-Reply-To: <20220424092511.100309-1-wanjiabing@vivo.com>
On 24. 04. 22, 11:25, Wan Jiabing wrote:
> Use if and else instead of if(A) and if (!A).
>
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> ---
> drivers/tty/hvc/hvc_opal.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
> index 84776bc641e6..2dafa0964c2a 100644
> --- a/drivers/tty/hvc/hvc_opal.c
> +++ b/drivers/tty/hvc/hvc_opal.c
> @@ -344,14 +344,15 @@ void __init hvc_opal_init_early(void)
> opal = of_find_node_by_path("/ibm,opal/consoles");
> if (opal)
> pr_devel("hvc_opal: Found consoles in new location\n");
> - if (!opal) {
> + else {
This looks good, except missing braces as noted by Joe.
> opal = of_find_node_by_path("/ibm,opal");
> if (opal)
> pr_devel("hvc_opal: "
> "Found consoles in old location\n");
> + else
> + return;
I am not sure this return is more obvious than the previous one. Rather
the opposite, IMO.
> }
> - if (!opal)
> - return;
> +
> for_each_child_of_node(opal, np) {
> if (of_node_name_eq(np, "serial")) {
> stdout_node = np;
thanks,
--
js
suse labs
prev parent reply other threads:[~2022-04-25 5:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-24 9:25 [PATCH] tty/hvc_opal: simplify if-if to if-else Wan Jiabing
2022-04-24 10:54 ` Joe Perches
2022-04-25 5:57 ` Jiri Slaby [this message]
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=2c1e137b-9866-4f6b-1413-0adaa8fdd57b@kernel.org \
--to=jirislaby@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=gregkh@linuxfoundation.org \
--cc=kael_w@yeah.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=wanjiabing@vivo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).