From patchwork Sat Aug 3 01:53:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nevo Hed X-Patchwork-Id: 1141425 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=starry.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=starry.com header.i=@starry.com header.b="h73O7MQK"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 460nFk0nldz9sMr for ; Sat, 3 Aug 2019 11:56:42 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CA9ECC21C4A; Sat, 3 Aug 2019 01:55:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3C07CC21DD3; Sat, 3 Aug 2019 01:54:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3A293C21DED; Sat, 3 Aug 2019 01:54:40 +0000 (UTC) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by lists.denx.de (Postfix) with ESMTPS id D182AC21DF8 for ; Sat, 3 Aug 2019 01:54:36 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id s145so56289184qke.7 for ; Fri, 02 Aug 2019 18:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starry.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9/XpgmTGFkKinzspMb7byG/++ffLLpg1sDBfdHftlEU=; b=h73O7MQKKMK83RsFUO+8TnUrJe5GyLEZcK+JTJBeA53+1vgrqCY1y5b1sfhruzPvMu GPasDMBHE2nTstgn5+WDAxhW8YAeUiPn1Uo7YkQWHR1PeeadYvptPEWBqb1HEh1pgci7 5M5/k5wddGvjoOl8G8nkwR2NgHaABVOzeJKII= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9/XpgmTGFkKinzspMb7byG/++ffLLpg1sDBfdHftlEU=; b=fehrFoXXPZI8KI8fuUjiAE7WRRsIrt4v1M4b2z8UWRnh6V77JGAP4m1KYUHGI5ezNC /DJH3bmYuv/fYRN8wJe3U7kIXHe944cjXtuXuEP4uPMcDFN9/GI3ejo5JaBUYE7D/Ein h5HDTMQB4iP7bO5y/ZkPG3wQYfOEd9avLbSMORFf4OrrmT5zfEXFwkBF7vW8/pEH4NKl AWJfqmusPxYKoMOBuWNq+srkZ56ShGrKVTV0dcHsxKfoACr6Y7YTcz02gxpmBVMD78un KFilre3sXhRHSnjRqVSpappvNdvG2bnm3G8mv6dQRGBUahIQhKR0uRAcHJN37UvnufhF hBeQ== X-Gm-Message-State: APjAAAXaBmZv1kpVD+3qHo4eL4GKbxhOkKcYGbnH5EfH+zG+rufaej3V 25yM4VRNEG+wfaMIU8gKnk1ZeA== X-Google-Smtp-Source: APXvYqzUqzXkHoV0DtxDlFH7OlL0wa2+DP0rouHnNkreCIIEDmzHpdb5rkVYY/JCLkiXJVAJNLHCBA== X-Received: by 2002:a05:620a:12f7:: with SMTP id f23mr90101269qkl.499.1564797275838; Fri, 02 Aug 2019 18:54:35 -0700 (PDT) Received: from nhed-lt1 (205-201-16-55.starry-inc.net. [205.201.16.55]) by smtp.gmail.com with ESMTPSA id m12sm30427818qkk.123.2019.08.02.18.54.35 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Aug 2019 18:54:35 -0700 (PDT) From: nhed+uboot@starry.com To: u-boot@lists.denx.de Date: Fri, 2 Aug 2019 21:53:25 -0400 Message-Id: <20190803015327.9345-5-nhed+uboot@starry.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190803015327.9345-1-nhed+uboot@starry.com> References: <20190803015327.9345-1-nhed+uboot@starry.com> MIME-Version: 1.0 Cc: make@marvell.com, Nevo Hed Subject: [U-Boot] [PATCH v2 4/6] net: mvpp2: no deref null X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" From: Nevo Hed phy_dev ptr is set from return of phy_connect() and is used before test to see if NULL. Obviously since the test already sxists someoen made the determination that this NULL is possible. Signed-off-by: Nevo Hed Reviewed-By: Ramon Fried --- drivers/net/mvpp2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c index fae7090121..5f908113f2 100644 --- a/drivers/net/mvpp2.c +++ b/drivers/net/mvpp2.c @@ -4494,7 +4494,8 @@ static void mvpp2_phy_connect(struct udevice *dev, struct mvpp2_port *port) * an option because it is required for the phy_fw_down * procedure. */ - if (phy_dev->drv->uid == 0xffffffff) {/* Generic phy */ + if (phy_dev && + phy_dev->drv->uid == 0xffffffff) {/* Generic phy */ netdev_warn(port->dev, "Marking phy as invalid, link will not be checked\n"); /* set phy_addr to invalid value */