From patchwork Tue Sep 15 14:10:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 1364375 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BrQBG6VdWz9sT6 for ; Wed, 16 Sep 2020 00:11:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5442681BD2; Tue, 15 Sep 2020 16:10:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id DDA9881BEB; Tue, 15 Sep 2020 16:10:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, KHOP_HELO_FCRDNS,SPF_HELO_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by phobos.denx.de (Postfix) with ESMTP id 3D91B81281 for ; Tue, 15 Sep 2020 16:10:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=biju.das.jz@bp.renesas.com X-IronPort-AV: E=Sophos;i="5.76,430,1592838000"; d="scan'208";a="57336195" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 15 Sep 2020 23:10:47 +0900 Received: from localhost.localdomain (unknown [172.29.52.114]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id C534A42C12C9; Tue, 15 Sep 2020 23:10:45 +0900 (JST) From: Biju Das To: Joe Hershberger , Marek Vasut , u-boot@lists.denx.de Cc: Biju Das , Michal Simek , Simon Glass , Tom Rini , Chris Paterson , Prabhakar Mahadev Lad Subject: [PATCH] net: ravb: Fix NULL pointer access Date: Tue, 15 Sep 2020 15:10:38 +0100 Message-Id: <20200915141038.3371-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.17.1 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.102.3 at phobos.denx.de X-Virus-Status: Clean Some phy's like rtl8211e do not support writeext() callback. Add a check to avoid null pointer access before calling writeext() callback. Signed-off-by: Biju Das Reviewed-by: Lad Prabhakar Reviewed-by: Michal Simek --- drivers/net/ravb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c index 886f53ee82..623d377897 100644 --- a/drivers/net/ravb.c +++ b/drivers/net/ravb.c @@ -438,7 +438,8 @@ static int ravb_config(struct udevice *dev) writel(mask, eth->iobase + RAVB_REG_ECMR); - phy->drv->writeext(phy, -1, 0x02, 0x08, (0x0f << 5) | 0x19); + if (phy->drv->writeext) + phy->drv->writeext(phy, -1, 0x02, 0x08, (0x0f << 5) | 0x19); return 0; }