From nobody Mon Jul 08 15:44:02 2024 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 4WHpM70Chmz5Pyy6; Mon, 08 Jul 2024 15:44:03 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHpM66p3Gz43nQ; Mon, 8 Jul 2024 15:44:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720453443; 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=WUiwkaOd7MmqmtNLyYBkqnqLPv9q1r8lmbO4VdS3U/w=; b=gUCfjH6kFohCdQ395LNrm3znbWXskeI6qZotL6HN1sgz7Ocogk5SFfP3Aq5zpTHZN62GrI OcLgbFfrMAsV45Rmu0iXcmBt8Hm/IZiENSqSepNhUY+tcShIzCDsGvy1NqHqFE0IiL/5gk D9BR84lZ9/frFDwTxtxNppyrMbxppAXNpO2OBg891kF4V0KartMQzb+ITrvkdkqSzFUggx QEgYrRxxmOgiHfgcTEWS97TdelHX6Wd5TaGwT80Kq4Cdz/xw6dEKzYooLlZLEZYG6IFuvX Z6jEklv4p4bKVq1/QSMKsvl5HRG9e/gge/eLl+4AHcqS5UVu/O+oqDz/0PvCvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720453443; a=rsa-sha256; cv=none; b=Ngd242gcckolq5vUlHbDlGJXKj6HSv5tLd2hXNjxADYUue0tMuCAm+v9/NLUilW/FE7DGX pdmDWfv8cwW0uMtHRvIwqC+T5i6RRCYlN8Fda2LjnPcG6rqxIWaDb5P9H3x97Pc8+vCGJj 10XOOixPzma47NtjSaoEb3EigjxnUV2QmVCvyzrH8HS0HGpWTUGjVmJ2Dufl5jyAwDmj/n 7Ve1Ok4PSiW/SANUJjRf8nlWx79rGPJXeYFM54K9jEv5WyztHYMgQW91smHcOJpv0whXDU LKYwKuoySrlm+KjGK2/EKIqAsrvIABonpZZTbB48Gn2pskJaBVh/pKVO+prgXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720453443; 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=WUiwkaOd7MmqmtNLyYBkqnqLPv9q1r8lmbO4VdS3U/w=; b=PqrL9tU/B0uYGGdNzVA1roC+ksSvztFA/4edv8fp0rl4C1hwEDv0FOin+G7rUBawErIY38 56ZFJH7Sm/qNzVF5GhBKYpRffa/zX4XaSaumURRCY1pXbx1EHPoSGSVRJhk/HDm9MfL6En p9sM6Mr7m7EhckrpbM1AEGb74m6waqgOD8NOrbmnqAO3zHNIW375UcplJ76uwIOpS5Rjfd 6nnEOcic5hOyueZGhmJ8ahjKxb8bO+KnkGNqouD/GUi1tV+lwxBfIfybH6PaZ6X/B9Ab+a kNNlRN+bftV3rUvF/Zv3rCOwq34HqqHj+3jnZV+UPnJ6eKH1r6O4HURkRJx2mQ== 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 4WHpM666LvzxKB; Mon, 8 Jul 2024 15:44:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 468Fi27I032482; Mon, 8 Jul 2024 15:44:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468Fi2nA032479; Mon, 8 Jul 2024 15:44:02 GMT (envelope-from git) Date: Mon, 8 Jul 2024 15:44:02 GMT Message-Id: <202407081544.468Fi2nA032479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: bdf2c8fff9ce - main - riscv: Don't need to check the return value with NULL 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bdf2c8fff9ced12a0cf6fc6b0e6757995c9a4412 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bdf2c8fff9ced12a0cf6fc6b0e6757995c9a4412 commit bdf2c8fff9ced12a0cf6fc6b0e6757995c9a4412 Author: wy-chung AuthorDate: 2024-07-01 09:01:07 +0000 Commit: Mitchell Horne CommitDate: 2024-07-08 15:43:48 +0000 riscv: Don't need to check the return value with NULL The return value from pmap_l1_to_l2 and pmap_l2_to_l3 will never be NULL, so don't need to check their return value with NULL. Reviewed by: markj, mhorne MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1311 --- sys/riscv/riscv/pmap.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 110f321a9461..8fb017f66951 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -1051,10 +1051,8 @@ pmap_extract(pmap_t pmap, vm_offset_t va) if (l2p != NULL && ((l2 = pmap_load(l2p)) & PTE_V) != 0) { if ((l2 & PTE_RWX) == 0) { l3p = pmap_l2_to_l3(l2p, va); - if (l3p != NULL) { - pa = PTE_TO_PHYS(pmap_load(l3p)); - pa |= (va & L3_OFFSET); - } + pa = PTE_TO_PHYS(pmap_load(l3p)); + pa |= (va & L3_OFFSET); } else { /* L2 is a superpage mapping. */ pa = L2PTE_TO_PHYS(l2); @@ -1128,8 +1126,6 @@ pmap_kextract(vm_offset_t va) } l3 = pmap_l2_to_l3(&l2e, va); - if (l3 == NULL) - panic("pmap_kextract: No l3..."); pa = PTE_TO_PHYS(pmap_load(l3)); pa |= (va & PAGE_MASK); } @@ -2505,8 +2501,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) va_next = eva; l2 = pmap_l1_to_l2(l1, sva); - if (l2 == NULL) - continue; if ((l2e = pmap_load(l2)) == 0) continue; if ((l2e & PTE_RWX) != 0) { @@ -2690,7 +2684,7 @@ resume: va_next = eva; l2 = pmap_l1_to_l2(l1, sva); - if (l2 == NULL || (l2e = pmap_load(l2)) == 0) + if ((l2e = pmap_load(l2)) == 0) continue; if ((l2e & PTE_RWX) != 0) { if (sva + L2_SIZE == va_next && eva >= va_next) { @@ -2770,7 +2764,7 @@ pmap_fault(pmap_t pmap, vm_offset_t va, vm_prot_t ftype) goto done; if ((l2e & PTE_RWX) == 0) { pte = pmap_l2_to_l3(l2, va); - if (pte == NULL || ((oldpte = pmap_load(pte)) & PTE_V) == 0) + if (((oldpte = pmap_load(pte)) & PTE_V) == 0) goto done; } else { pte = l2; @@ -4770,7 +4764,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) continue; } l2 = pmap_l1_to_l2(l1, tmpva); - if (l2 == NULL || ((l2e = pmap_load(l2)) & PTE_V) == 0) + if (((l2e = pmap_load(l2)) & PTE_V) == 0) return (EINVAL); if ((l2e & PTE_RWX) != 0) { /* @@ -4784,7 +4778,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) continue; } l3 = pmap_l2_to_l3(l2, tmpva); - if (l3 == NULL || ((l3e = pmap_load(l3)) & PTE_V) == 0) + if (((l3e = pmap_load(l3)) & PTE_V) == 0) return (EINVAL); /* * TODO: Update the L3 entry if the attributes don't match once