From: Jean-Jacques Hiblot Date: Fri, 22 Jun 2018 14:25:29 +0200 Subject: [U-Boot] [PATCH v3 2/7] net: eth-uclass: Fix for DM USB ethernet support In-Reply-To: <1529670334-21974-1-git-send-email-jjhiblot@ti.com> References: <1529670334-21974-1-git-send-email-jjhiblot@ti.com> Message-ID: <1529670334-21974-3-git-send-email-jjhiblot@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de When a USB ethernet device is halted, the device driver is removed. When this happens the uclass private memory is freed and uclass_priv is set to NULL. This causes a data abort when uclass_priv->state is then set to ETH_STATE_PASSIVE. Fix it by checking if uclass_priv is NULL before setting uclass_priv->state Signed-off-by: Jean-Jacques Hiblot Acked-by: Joe Hershberger --- Changes in v3: None Changes in v2: None net/eth-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/eth-uclass.c b/net/eth-uclass.c index e4b4922..3a5217a 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -312,7 +312,8 @@ void eth_halt(void) eth_get_ops(current)->stop(current); priv = current->uclass_priv; - priv->state = ETH_STATE_PASSIVE; + if (priv) + priv->state = ETH_STATE_PASSIVE; } int eth_is_active(struct udevice *dev) -- 2.7.4