From nobody Sat Nov 26 16:01:55 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NKGh35DCsz4hRx9; Sat, 26 Nov 2022 16:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NKGh34nFWz3t7G; Sat, 26 Nov 2022 16:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669478515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dKxo2o7h0kK2zmoWNF7LgMHOw6qD2EO8+tzLQcYUTyk=; b=xV8NG/tYdYkqXZlQhihtwJsGzItN1ydhYSpaFRQ0mK+U1ggygzamanaG9rvB0JE+FZuqzk YLdLD02AjDsznWqI+L6LiL/S/YvTl4rkwoQo6PR76Xae8QtbbQkJEUobA622LAHbFpFbyB QmWGhqKVQzyXH82ZA+pHYFH0DvIB0+7TitLF2a6uZltQyBS6wrqR8TxMSp7oYpOu03fMCm 94+4eTGlDl0UNsTDDsHzn6CA/ESC8BIw43nIv6hDC1coq9AGFAuqUTW7YmrLndRmT6Zluw KWzVridcHBZyljfSn5dGMdzCdnbif1zC990iegn2+xbxtIi5LhjwmpCkj0Gatg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669478515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dKxo2o7h0kK2zmoWNF7LgMHOw6qD2EO8+tzLQcYUTyk=; b=Df1G6/O2xHmB0xiOVlGtIMBaCbTzzw4EXfva3dxLzKBau3eTziox8SaoM+V+ft2imjBjSM B07c3h40M7XlPn1RqiQ7hb58LM2kD6OiL1Gc1uYrx1JqhhyJn4zO6hUcdx9gODSAoOs5VZ 9VZiYPRhH29nazIzxB5hnVHdmotG+olDn1gC0xbfhSprroYfphi4ZzDx6Ou8oi9PCAAlJk 4RG9/wddAz8lelZodw2R9qXmZUM6rSsncPAN95g182m2FVzIhf0lzABzb4LyQ6zJtuY2fT E5NsFGlTQTS4lojZN7mbm9o9vewjdP45KloU8v5pBIyrhWTe3ax1IAqhWIFEUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669478515; a=rsa-sha256; cv=none; b=ubiXOXwqARr0Nnh21RJgnXYkvs/c79EeHEoEvg6SAt/RHN/YMpvvtflmOE2eipJ4IP24kE +9Qom42r3lmvIt8ArBhojuz90Uzlgmu5jCou/YYYAO6aoIR2w/igA36o55zg4YEaVMbjtI 5AKjC5Zt9mJx3uHlWwxkxzgMu5jzwvxPpsz7kHNXm9ITxW6aBIUWYDu6P1Hwp0P94jZGfF xGlE9wfnVzlt2Wu187/xnas0QUxBGJSJsyjVis3X7o1X6LiDM8PTHet6fjQBs1c6McVqae EiNWoo9U6Pb3buhZ/axDCQuAfi9Xc10FjdJoToJ0ZsgBAxmo51IXxVBpxTaWbw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NKGh33s0wzQRy; Sat, 26 Nov 2022 16:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AQG1tgZ077654; Sat, 26 Nov 2022 16:01:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AQG1tNm077653; Sat, 26 Nov 2022 16:01:55 GMT (envelope-from git) Date: Sat, 26 Nov 2022 16:01:55 GMT Message-Id: <202211261601.2AQG1tNm077653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 21d5b592faa1 - main - dpaa: Account for MDIO device not being found List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 21d5b592faa1cd71c201acfb2686b79e0bbba9f7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=21d5b592faa1cd71c201acfb2686b79e0bbba9f7 commit 21d5b592faa1cd71c201acfb2686b79e0bbba9f7 Author: Justin Hibbits AuthorDate: 2022-11-26 15:38:13 +0000 Commit: Justin Hibbits CommitDate: 2022-11-26 15:55:21 +0000 dpaa: Account for MDIO device not being found It's possible the MDIO device hasn't been and attached, or is incorrect in the device tree so can't probe and attach. In this case, ofw_bus_find_child_device_by_phandle() will fail, and return NULL. Return an error from find_mdio() here to prevent the MAC from attaching, rather than worry about a NULL pointer dereference later on when accessing the PHY. --- sys/dev/dpaa/if_dtsec_fdt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/dpaa/if_dtsec_fdt.c b/sys/dev/dpaa/if_dtsec_fdt.c index 67f34683b66a..1ab331caf0d1 100644 --- a/sys/dev/dpaa/if_dtsec_fdt.c +++ b/sys/dev/dpaa/if_dtsec_fdt.c @@ -125,6 +125,9 @@ find_mdio(phandle_t phy_node, device_t mac, device_t *mdio_dev) bus = device_get_parent(mac); *mdio_dev = ofw_bus_find_child_device_by_phandle(bus, phy_node); + if (*mdio_dev == NULL) + return (ENOENT); + return (0); }