From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 38569C433EF for ; Mon, 25 Apr 2022 05:58:16 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KmvSk25k6z3bw6 for ; Mon, 25 Apr 2022 15:58:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.218.54; helo=mail-ej1-f54.google.com; envelope-from=jirislaby@gmail.com; receiver=) Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4KmvSF6Glqz2xvy for ; Mon, 25 Apr 2022 15:57:47 +1000 (AEST) Received: by mail-ej1-f54.google.com with SMTP id w16so6249998ejb.13 for ; Sun, 24 Apr 2022 22:57:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=7gVJ2Utcvosx/ULF+UBSbPDY0euXt/mFCYfcwdEKABE=; b=V/8wBqkt4M5r39aorB1rdsjhqi5oDj9RvzeGRgKean631Dy+vUZjgkXlhLOzPI+tKu Nu4N95qq730FSIeuGTqxEGPOQpDdDC10aGd56+lCtDl42jzhEgc4Z7bcxNKemMO+swG5 0ZGKMHf3t/jvGmp359ghqMoyM3O+CJE1nJtSo/uSpep4FLQqsuKhAIy/MEKlYe5ES5WD 33cymnelHa08CSEITQwpwgctlkGgg5fJJkflmFmDky2xBu+RuUZn7CnFU7eFSNyh09tJ DdID6ezEKnF9+hGR57h3IOYQdd+nMqNtkwkCBckVkuqlDNxWZxKVJ5Hv8GdxpNHFGjZk 2ZHw== X-Gm-Message-State: AOAM530ESKyNWc/HViJ+Q4XkAL9U8O6xI5zNbuo2pVRZ3OHa2DvEbKXy fGaf61FI2CdG6iwU2m0rc0s= X-Google-Smtp-Source: ABdhPJwNjWzQpWbujPmDPI0ystpnRedGsg7AJyeQ/ZLHueI3IpwaY4uVuJMpcbXmNjzSmbYS0LCifg== X-Received: by 2002:a17:906:4313:b0:6b8:b3e5:a46 with SMTP id j19-20020a170906431300b006b8b3e50a46mr14695767ejm.417.1650866262907; Sun, 24 Apr 2022 22:57:42 -0700 (PDT) Received: from [192.168.1.49] (185-219-167-24-static.vivo.cz. [185.219.167.24]) by smtp.gmail.com with ESMTPSA id o5-20020a170906974500b006dfc781498dsm3262766ejy.37.2022.04.24.22.57.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Apr 2022 22:57:42 -0700 (PDT) Message-ID: <2c1e137b-9866-4f6b-1413-0adaa8fdd57b@kernel.org> Date: Mon, 25 Apr 2022 07:57:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] tty/hvc_opal: simplify if-if to if-else Content-Language: en-US To: Wan Jiabing , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Greg Kroah-Hartman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20220424092511.100309-1-wanjiabing@vivo.com> From: Jiri Slaby In-Reply-To: <20220424092511.100309-1-wanjiabing@vivo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kael_w@yeah.net Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 > --- > 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