From nobody Fri Jan 16 19:40:57 2026 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 4dt9FP5sk8z6NldV for ; Fri, 16 Jan 2026 19:40:57 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dt9FP2Dz3z3x5g for ; Fri, 16 Jan 2026 19:40:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768592457; 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=DICw4Q9H7rnoWaeP1o9I6K24T/7cMiOi1akwJHyjKlI=; b=olF/GmcwFcuDx1/zuH/Fd3kpXsbaACJCwD/BQp4svUtiuyfAm1R+TBvurCAalNIJlC7QC4 tZgeoKCBGtKcoRBuf21vOQVz0EUV1tGCzE12ZkE04R/VSjxwuWGmXl9UMwk5HNdS+wnkVS HRTV65BliI0kigqegpiXpl5ZeMDwWioS8nhMCieX3TXr9C1efVwQT9P+ws82cJ+TqW6dUj Xig7puhoVNBT0SMRWXWTEBs6qlAAs3cTAjjc7papW63JqrMpAs8a/6sn+e59bs7sY4VAPW 7GDU1zDPjVUEHf8ZrC0aUDTy5FOnPXqt+beSOax/hqnb7JFxEzQBpYP/nFGQ7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768592457; 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=DICw4Q9H7rnoWaeP1o9I6K24T/7cMiOi1akwJHyjKlI=; b=sO+FhMlbThHD28Qc9tMMB16rMh42YNvtJjDqGhuoMVP1gwcIEaafL5NDLiaV2XewSZtyeb aOJtoQkQ1FMGhLy3ecTo85hE137ZesixnZdecNIDSmZ62Iovcc1ZLAqAqeEWoO8m36f/zO etZejIOjH1g0w2FJfLTrE/5hFERUWFBoVYYd8/DrOZWByPj51XwulGkiLFIqXjBIhk3lam JHZIQmY2+9dQ/P3qG+C2X8g+zurPBWIFpnuAt1LS/EV2tkP+x7xEf4Tpf8xOnAdq79nhrO L7Zp5Vq+8JNfJvarRo6Y/igwu9LbIWhbNaKEAdRTy1TQTsgd1J1WpKlX+9cBuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768592457; a=rsa-sha256; cv=none; b=K9z9YjLRUzvkqRL8YwK/D33KORN0PdQ3XcyV77ApH7DobgA/TEn1PDPGtVihZShHP6sc7Y OQpJGkw1yzGOuXWOEjWgVZk4d7jt5ZjVHTu8u0nTBbhKNXF6irZTGekxZ2+bG2T7/a9qgy kq0YG53lcaEIMvGejBvYMrhaRRLA7c17jhdo8+7JbGLsYexnPBAZf2dSiUX/Bt+grwQs2O BpetTpHj5ZVbbuuRkuHkGN4wc2lcdU6dldNfS+JLapJn3LtZHPo7ZnqJmzQK0rXn8n4hdo 3W9FhqUlAqllRVPARbJPeVmwWKXq3AN7xGoQjxT2wqj5MuTZlbFWuE0Syv0jOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dt9FP1qDNzCKD for ; Fri, 16 Jan 2026 19:40:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id de14 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 16 Jan 2026 19:40:57 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 6ceb046df3d7 - stable/14 - LinuxKPI: cleanup: implement __free() and DEFINE_FREE(); use for kfree() 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6ceb046df3d72dfa2c218fdb9b32635d11bdcfcd Auto-Submitted: auto-generated Date: Fri, 16 Jan 2026 19:40:57 +0000 Message-Id: <696a9449.de14.1ec1d525@gitrepo.freebsd.org> The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=6ceb046df3d72dfa2c218fdb9b32635d11bdcfcd commit 6ceb046df3d72dfa2c218fdb9b32635d11bdcfcd Author: Bjoern A. Zeeb AuthorDate: 2025-09-04 20:24:55 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-01-16 19:37:48 +0000 LinuxKPI: cleanup: implement __free() and DEFINE_FREE(); use for kfree() A wifi driver update needs this. Sponsored by: The FreeBSD Foundation (initially) Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52075 (cherry picked from commit 39e9290d890b2aa07b68f2fe956b96e5df9a1da2) (cherry picked from commit 830cc677d97eebd02ade8b33ec17de38f2705a73) --- sys/compat/linuxkpi/common/include/linux/cleanup.h | 14 +++++++++++++- sys/compat/linuxkpi/common/include/linux/slab.h | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/cleanup.h b/sys/compat/linuxkpi/common/include/linux/cleanup.h index 01f234f0cbe7..45c2a2359ddf 100644 --- a/sys/compat/linuxkpi/common/include/linux/cleanup.h +++ b/sys/compat/linuxkpi/common/include/linux/cleanup.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2024 The FreeBSD Foundation + * Copyright (c) 2024-2025 The FreeBSD Foundation * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. @@ -43,4 +43,16 @@ guard_ ## _n ## _t guard_ ## _n ## _ ## __COUNTER__ \ __cleanup(guard_ ## _n ## _destroy) = guard_ ## _n ## _create +#define DEFINE_FREE(_n, _t, _f) \ + static inline void \ + __free_ ## _n(void *p) \ + { \ + _t _T; \ + \ + _T = *(_t *)p; \ + _f; \ + } + +#define __free(_n) __cleanup(__free_##_n) + #endif /* _LINUXKPI_LINUX_CLEANUP_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index efa5c8cb67b3..725417acc017 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -40,8 +40,10 @@ #include #include #include +#include #include #include +#include MALLOC_DECLARE(M_KMALLOC); @@ -152,6 +154,8 @@ kfree(const void *ptr) lkpi_kfree(ptr); } +DEFINE_FREE(kfree, void *, if (!IS_ERR_OR_NULL(_T)) kfree(_T)) + /* * Other k*alloc() funtions using the above as underlying allocator. */