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 X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A15C5C4338F for ; Sun, 1 Aug 2021 19:20:58 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 18AAF60230 for ; Sun, 1 Aug 2021 19:20:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 18AAF60230 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0FA4B832F0; Sun, 1 Aug 2021 21:19:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="W3D4gifi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 28572832E4; Sun, 1 Aug 2021 21:19:51 +0200 (CEST) Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0F7808321F for ; Sun, 1 Aug 2021 21:19:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-oi1-x236.google.com with SMTP id q6so21525316oiw.7 for ; Sun, 01 Aug 2021 12:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i2q/CAY3lZ4GnGHH68L23urtWxtiPXjCvm607wNNT+M=; b=W3D4gifiJyqIyglauyda3c58558r2MLEkz4A+HGQkBvCNzL5JoaNfw9ikU4Vi6PJzk jSQ4VHco9iO4Xi8c5ifk3ORhwXmXhyvSjdcNCxrR6hO9EvQAhaqAWmtw3NRhQED6PgQr ieBSODbtJ2mlhb89o9Kg4ShIsmY9lsSHMs4cI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i2q/CAY3lZ4GnGHH68L23urtWxtiPXjCvm607wNNT+M=; b=M8awC0RUkVOfgGnjw/kmsniFgKwSdi9jSHlF7rZB2uey8OYljlUJwLodqSNW/yNGsk oZ1IgJ6rggA3U3Am5CAWe4MstUT1Rri05/oMHJVuUYL+UOsAuvpNS2CbE5tWIu1o9DZK aHGx/AsIN9jq0+n8oP2h8bzxE2edM3kwyFjuUPlDdgB4qCwgbazE9uAaQB1E/a38gGoE KaQUhm/rzneYtJNgHPWm9chH3+TNI1xn2S9ltMNUtzOjl1MI4GgN9riMLPN3J+7mAJlU 8NQPix3n7jD5+36hbsgByyO8wRxv8spjYVj5DBjLmMfisPQbpbOWtfDRctkMkOPW0tVE Le8w== X-Gm-Message-State: AOAM533nyAB6I3XIQCOKQIV65jpD51DFfgEh6wDBMpJweF0gJWl3eqt+ 9at64uOf69cZSBKKbbVD/zyQ3GrFxK2gZ3ccrZTqGUiv94sb4A== X-Google-Smtp-Source: ABdhPJxrNc6Kjn6326cgWT66uNJ+pkVfNL3yo02D2JQjyEeq5Cofd9GdcV2gEaxHOYIf++XoFtLDIQNLrnwBgb8Y0Kk= X-Received: by 2002:a05:6808:1791:: with SMTP id bg17mr1972549oib.81.1627845586467; Sun, 01 Aug 2021 12:19:46 -0700 (PDT) MIME-Version: 1.0 References: <20210731131652.19206-1-bmeng.cn@gmail.com> In-Reply-To: <20210731131652.19206-1-bmeng.cn@gmail.com> From: Simon Glass Date: Sun, 1 Aug 2021 13:19:34 -0600 Message-ID: Subject: Re: [PATCH 1/2] x86: queensbay: Optimize disable_igd() a little To: Bin Meng Cc: U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Bin, On Sat, 31 Jul 2021 at 07:17, Bin Meng wrote: > > Initialize igd and sdvo to NULL so that we don't need to test the > return value of dm_pci_bus_find_bdf() later. > > Signed-off-by: Bin Meng > --- > > arch/x86/cpu/queensbay/tnc.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/cpu/queensbay/tnc.c b/arch/x86/cpu/queensbay/tnc.c > index 782ed863fe..e38c0198e4 100644 > --- a/arch/x86/cpu/queensbay/tnc.c > +++ b/arch/x86/cpu/queensbay/tnc.c > @@ -18,18 +18,15 @@ > > static int __maybe_unused disable_igd(void) > { > - struct udevice *igd, *sdvo; > + struct udevice *igd = NULL; > + struct udevice *sdvo = NULL; > int ret; > > ret = dm_pci_bus_find_bdf(TNC_IGD, &igd); > - if (ret) > - return ret; > if (!igd) > return 0; This is backwards. If ret returns 0 then we know igd is non-NULL. So check the return value. That is what it is for. You can drop the check of igd. Same below. > > ret = dm_pci_bus_find_bdf(TNC_SDVO, &sdvo); > - if (ret) > - return ret; > if (!sdvo) > return 0; > > -- > 2.25.1 > Regards, Simon