From nobody Fri Jan 13 21:24:45 2023 X-Original-To: dev-commits-src-main@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 4NtvZQ2Zcyz2qkNG; Fri, 13 Jan 2023 21:24:46 +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 4NtvZQ14Wkz40Lv; Fri, 13 Jan 2023 21:24:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673645086; 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=IJcuidBL0iCyANtFsf5cMdzDK98Nc5WVyxy4QPQsN8k=; b=e+22f67O85S4PMXwZvF/nmuHdLL/CN6uWVBEmV5vkU8xYIv+N21R7M28lL/3SB3yHsG9h2 c2cLyCByDA7pR0xS7E4QZa0tw76wXoBhMdhijm0rU530ROoXIYUBnXoAaId0EObwqKmMhg SwxvOO73LTtEg/vRMSRW4MoDLgfslJXuCE23Ifijoubexe/vO9ZnsAObcchUI+NF6wldBE bhJKT1/JTdQsw99OIvHk9HE58EVVw504pcnLkW87RM69zHpUdmfrUA00MCXNCidKyXvHfK nFTE948+qI6hrNlzivDfe3IRa0Weo2RKWfN0fnMNrcqOa8UblzmQOw43iXYdIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673645086; 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=IJcuidBL0iCyANtFsf5cMdzDK98Nc5WVyxy4QPQsN8k=; b=iaPW9hh5Ku9s2iWq2zg5UzJ78Bwz6jfn+JBvs291DnRp/ZCo+/R4l2W6Su4/7IBIw0rmAQ jkfKDPh73My+cPhNk9U1tFr728IQrDtNIzeOtaJjVU3+WccE3yvvaGO/9X7ievC74Eu12S 2pRq4GW4DpcaN69QcllMHW1FOIFf2ko/Clh5NzJvpco12E6lh4k8NSbfDIL3117J8uF1zc QVpzM/2V/jdRvvOmGGEBi9sWxa1RWJtdJricaUaXP6zp/LT29sFhyJ900SEz7D3l9dB9na ZHuzZyeS26neWZy4t0xWyr1I2f6eLJ6xixTJkfuoDTRHX6M6mGFlH15KF2dB2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673645086; a=rsa-sha256; cv=none; b=PSEYJMrW0GuxNk9zSTktwJZ4882gI265+qImmQDK5TDIudE5CyqpKoUtJkIFXcMwQfZXjP JiL7+frCcZG3ex7gEwDfU73EY5tHqixQ1Xy6LtjyE5DTwLAqmOz2Xcto+Bh30DM2JeAA8k tTELKAk8pk7EgMKcranQ9NA8HZUp4O9E8YJMC2GJpD2g7hzLRdVCUtyIjv2JL9/A2xSXmT PoewGkVN5/DkCcUQCJyFkEL/dtRDuOv8I/hk8YFT9P5/wznhmxtcFT0zsi+e0J5p0ru/qz Xbnt/9TGc6+AgSqy+R0+FuBpUpYtPvo5Y7oRdcUPAEHzccNvkVc8lj+1u70VmQ== 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 4NtvZP6lwqzND8; Fri, 13 Jan 2023 21:24:45 +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 30DLOjNb040625; Fri, 13 Jan 2023 21:24:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30DLOjeS040624; Fri, 13 Jan 2023 21:24:45 GMT (envelope-from git) Date: Fri, 13 Jan 2023 21:24:45 GMT Message-Id: <202301132124.30DLOjeS040624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 5740057b4388 - main - stand/uboot: Explain why we test for NULL here List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5740057b4388f116717b9614cd54cf2c755e6e7d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5740057b4388f116717b9614cd54cf2c755e6e7d commit 5740057b4388f116717b9614cd54cf2c755e6e7d Author: Warner Losh AuthorDate: 2023-01-13 21:19:47 +0000 Commit: Warner Losh CommitDate: 2023-01-13 21:22:38 +0000 stand/uboot: Explain why we test for NULL here Most parsedev routines assume that idev is non-null and can always be set. Since we break from this pattern in uboot, explain why in a comment. devparse was invented to put a lot of common code in one place and to simplify the archsw.arch_getdev code and any dv_parsedev code called. However, uboot couldn't use devparse at the time because its device naming scheme slightly different parsing. So, we still use uboot_parsedev directly from uboot_getdev where dev could be NULL. Add a comment to this effect. The match functionality added for ofw likely could be used to clean up the multiple kludges that are here for uboot's device naming differences with the normal boot loader. This work will wait for the future. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38042 --- stand/uboot/devicename.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stand/uboot/devicename.c b/stand/uboot/devicename.c index 075880baa59f..d5de86384369 100644 --- a/stand/uboot/devicename.c +++ b/stand/uboot/devicename.c @@ -148,6 +148,10 @@ uboot_parsedev(struct uboot_devdesc **dev, const char *devspec, goto fail; } idev->dd.d_dev = dv; + /* + * dev can be NULL, since uboot_getdev calls us directly, rather than via + * dv_parsedev in devparse() which otherwise ensures that it can't be NULL. + */ if (dev == NULL) { free(idev); } else {