From patchwork Tue Aug 6 15:51:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nevo Hed X-Patchwork-Id: 1142903 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="Mp6hOGds"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 462zkY0lpsz9sN1 for ; Wed, 7 Aug 2019 01:55:49 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CB2EAC21F37; Tue, 6 Aug 2019 15:53:04 +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_H3, RCVD_IN_MSPIKE_WL, 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 E54C1C21EF1; Tue, 6 Aug 2019 15:52:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A7278C21EF7; Tue, 6 Aug 2019 15:52:07 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) by lists.denx.de (Postfix) with ESMTPS id 2187FC21EE8 for ; Tue, 6 Aug 2019 15:52:07 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id k10so15868659qtq.1 for ; Tue, 06 Aug 2019 08:52:07 -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=HRv4EUw7hAYPi3d6aMelEZhMTcIaniiLxASk/c++pSY=; b=Mp6hOGdslNEekBnMlMMYhw/kaY0wJinVhKFPtBLuEQuOaoGHRcbduH+iOZ6eSRuXmR z9k4GzDToZz7EiIsCE4cFewFpZzaF0V2tHz7DZeS910LF4w1XZZ63F07Fk9LLrZE2cN0 mMv2/8UBU7T8VQT6/VIvaMVDnLZ5NFjJHmHTg= 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=HRv4EUw7hAYPi3d6aMelEZhMTcIaniiLxASk/c++pSY=; b=Zb4xI8IUhGUF7zl5EwEm5uah7uAooiYzJXUtZHJmVfiMokX12W3MI2RCKltQtezJ+h ODd0GVApM7zecRBV9bUHiC5yXr1Mo21Xfs713y5jJsltcxzGMTiEoGbcsOzL5q0d7YbQ hsSJgPAuCLMvrMJ9JvzIj7Qsm/2O6HU/tNkRWfAXOaxaL94cKRNK34d4b3/YWlsf4J+F PYMdoucwZDcywER/aU+NLCqrbdnnHEMDHKiG/EEDJU95uCJY38DOrrL30pbxvxyLk51J uLG4/n9qGY6MhOJLuaJaRAFdD2L8ULtpqrTQvmulCClbJ1+bv6D9BWpbTni08AgtpzBH ordw== X-Gm-Message-State: APjAAAU2ZA9uu/HR86WngiBA89kSsIKAEBihRthVlo/zDHd2GK+bmECB Asbp2fG9HNAN3MZhYWNwDRagHA== X-Google-Smtp-Source: APXvYqzFVdoSD050d+51hR9BPR7i8OJFIO4XDOBWHAwaYyBaUgAVHsIHQtqC+q8PMKobJrE7/DWUqw== X-Received: by 2002:a0c:d4eb:: with SMTP id y40mr3661213qvh.30.1565106726115; Tue, 06 Aug 2019 08:52:06 -0700 (PDT) Received: from nhed-lt1 (205-201-16-55.starry-inc.net. [205.201.16.55]) by smtp.gmail.com with ESMTPSA id m3sm34894119qki.87.2019.08.06.08.52.05 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Aug 2019 08:52:05 -0700 (PDT) From: nhed+uboot@starry.com To: u-boot@lists.denx.de Date: Tue, 6 Aug 2019 11:51:41 -0400 Message-Id: <20190806155144.19301-5-nhed+uboot@starry.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190806155144.19301-1-nhed+uboot@starry.com> References: <20190806155144.19301-1-nhed+uboot@starry.com> MIME-Version: 1.0 Cc: make@marvell.com, Nevo Hed Subject: [U-Boot] [PATCH v3 4/7] 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 someone 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 */