From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01C5E3F822A for ; Mon, 27 Jul 2026 11:15:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785150925; cv=none; b=aew6QyTYtznzdLRY8gN8Tk6vHV47K7JzobOXWeIno2G8e4RFqCmJtm0MDeD373mYYvsKpXlo5Kfh1yEYSHU1zVJWd3BjFNmo4RUWaF2gmARHNTzkt6MwCkk/n/y6S/HI0hVpd7y6aWkQoTjMgerN7RUSNwIM+4O/TfDjp1YEEDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785150925; c=relaxed/simple; bh=FSGGFdDhWSnb8CCbvnx3/qBrQn+EJBu2CTO1ACrdCv8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:In-Reply-To: Content-Type:References; b=OOM1bWs0OetQPSfWBlUMFjApxY95AVL+hbmWT3bZHIgYMPcyvHGhV/c+YwGHAGTj2t7pONdWmLAkRGFUmMPbiAaj+pe+4DevI97F2kZe69VK8LYBXLvZDdCmkJ8NNq8ovaT5dMyBeD8MKkbfNYNqbDnZXPu/X25iuSbf48ZOZfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=DHCNX6Tf; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="DHCNX6Tf" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20260727111515euoutp023693aad44b356e44feacb8484ad805b1~GIUyoppAh0749507495euoutp020 for ; Mon, 27 Jul 2026 11:15:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20260727111515euoutp023693aad44b356e44feacb8484ad805b1~GIUyoppAh0749507495euoutp020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1785150915; bh=A7ERjbMk+yFZshthB0sp+/tIp9yvMUlmWK307gnlUbA=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=DHCNX6TfMMrrGLGiAogKgGrGc54pm9hMLZKxN+f/DROTose/ZDPN8wxFiG3goWpFU ufonCu65Wo8Tak70rsiBGeA34I93TtVspvt7flyfWmooFrgHzvudOkXemzB2Ikl6A7 k2mCVnU7JPaztIcGsAIfxak6PPDNDnD1ylSQQeuo= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20260727111515eucas1p27222fc8db945ebaa9fbdb982273ba8c5~GIUyZ5zFn0254302543eucas1p2-; Mon, 27 Jul 2026 11:15:15 +0000 (GMT) Received: from [192.168.1.44] (unknown [106.210.136.40]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20260727111514eusmtip139c438f59f7bb6c2db48ab040612e603~GIUxyucU80770907709eusmtip1v; Mon, 27 Jul 2026 11:15:14 +0000 (GMT) Message-ID: Date: Mon, 27 Jul 2026 13:15:14 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] rust: pwm: replace `core::mem::zeroed` with `pin_init::zeroed` To: Francis Laniel , Miguel Ojeda , =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Benno Lossin , Gary Guo Cc: Alexandre Courbot , Boqun Feng , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , linux-pwm@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Content-Language: en-US From: Michal Wilczynski In-Reply-To: <20260603160910.159307-1-laniel_francis@privacyrequired.com> Content-Transfer-Encoding: 7bit X-CMS-MailID: 20260727111515eucas1p27222fc8db945ebaa9fbdb982273ba8c5 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20260603160927eucas1p1ae24e871a8ef0771d72fae6462d96318 X-EPHeader: CA X-CMS-RootMailID: 20260603160927eucas1p1ae24e871a8ef0771d72fae6462d96318 References: <20260603160910.159307-1-laniel_francis@privacyrequired.com> Hi Uwe, On 6/3/26 18:09, Francis Laniel wrote: > All types in `bindings` implement `Zeroable` if they can, so use > `pin_init::zeroed` instead of relying on `unsafe` code. > > If this ends up not compiling in the future, something in bindgen or on > the C side changed and is most likely incorrect. > > Suggested-by: Benno Lossin > Link: https://protect2.fireeye.com/v1/url?k=851847ef-eca32f5d-8519cca0-905a08a8515a-5adce8ef7cc40eb1&q=1&e=6c6d6a32-0f0e-4805-8882-718eae7641a8&u=https%3A%2F%2Fgithub.com%2FRust-for-Linux%2Flinux%2Fissues%2F1189 > Reviewed-by: Alexandre Courbot > Acked-by: Michal Wilczynski > Signed-off-by: Francis Laniel > --- > rust/kernel/pwm.rs | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/rust/kernel/pwm.rs b/rust/kernel/pwm.rs > index 6c9d667009ef..3427b7d93a03 100644 > --- a/rust/kernel/pwm.rs > +++ b/rust/kernel/pwm.rs > @@ -494,9 +494,7 @@ pub(crate) fn as_raw(&self) -> *const bindings::pwm_ops { > /// This is used to bridge Rust trait implementations to the C `struct pwm_ops` > /// expected by the kernel. > pub const fn create_pwm_ops() -> PwmOpsVTable { > - // SAFETY: `core::mem::zeroed()` is unsafe. For `pwm_ops`, all fields are > - // `Option` or data, so a zeroed pattern (None/0) is valid initially. > - let mut ops: bindings::pwm_ops = unsafe { core::mem::zeroed() }; > + let mut ops: bindings::pwm_ops = pin_init::zeroed(); > > ops.request = Some(Adapter::::request_callback); > ops.capture = Some(Adapter::::capture_callback); I believe this commit is good to go, if you could take it through your tree it would be great. Best regards, -- Michal Wilczynski