From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8FB0A19DFAB; Mon, 7 Jul 2025 09:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751879712; cv=none; b=B2rxQFsgFblr2ArkQ6WMTmbKDbCUfas1KOwqY1s9s2jRg09jEvZH20DX2jv/pG8bf3sagDtVpxHej9QMT91PMTwoaMq4ZbPKMEfZCPZhgJMTgWV/yjc885qteHoE0wWV1Ca8rfnf/4bry86HahW2lDAVg06SM5GMc1RckhMUfpw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751879712; c=relaxed/simple; bh=s5LNAqpqCTtOzeV5j3oi7jngQje+htJG71VU5WzpWQE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Ty76zZhZHtZlsMmXbYB64nkHP50pBfbZ0gtwuCnkBAr103XM+3JindWyuYiow/PmTKOT2tCnBWVv6CTV+nRWKsCmp4Sqy6p/1dFqjngS+4+X+jjygkN6epWkYH22MS4wXyd2lgDyeKulWG8X/KNoSGWti34vW46Nl+HHNlWEr9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WDMBMGRh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WDMBMGRh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFEE6C4CEEF; Mon, 7 Jul 2025 09:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751879712; bh=s5LNAqpqCTtOzeV5j3oi7jngQje+htJG71VU5WzpWQE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=WDMBMGRhjhaSH4iS9+2wyp0jAQP7F9gwtbtFBmJkfmYes/iElDwBHe0qFwfq+HhEL OaxleHZlFo93WjGT4aXDJv37B10j6diALCLaAE0ETwZessChqz/lT6yvLhDT2sEDnV YwWA106nDbY3SW5gMPA8fmr6sWYOmU3HOOpur1+Lj0mY3Fmqgb/ebcPkkBZM9WMehg /MWJnFyh2ek03Vw2uprTeRq0Gdbfgr6wjF1fd3K++bN+pL4hKo0fKjfEFT91TaALpF M9Qylp4CdNrkZ/P4cpBMAjH1dqD7I95jQddwzWKaLFnYVFrZFeejyTLLxP6vQUpuSH QSzAS7uzHNBVQ== Message-ID: <1b0aba4d-5e4f-4f5e-9a3a-978d6fde2847@kernel.org> Date: Mon, 7 Jul 2025 11:15:05 +0200 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 2/6] rust: pwm: Add complete abstraction layer To: Michal Wilczynski Cc: =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Trevor Gross , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Marek Szyprowski , Benno Lossin , Michael Turquette , Drew Fustini , linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org References: <20250706-rust-next-pwm-working-fan-for-sending-v9-0-42b5ac2101c7@samsung.com> <20250706-rust-next-pwm-working-fan-for-sending-v9-2-42b5ac2101c7@samsung.com> <002c8275-f17d-4a4e-b6b8-4dc74c4d510d@samsung.com> From: Danilo Krummrich Content-Language: en-US In-Reply-To: <002c8275-f17d-4a4e-b6b8-4dc74c4d510d@samsung.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/7/25 9:30 AM, Michal Wilczynski wrote: > On 7/6/25 14:23, Danilo Krummrich wrote: >> If you overwrite this callback (as you do below) you're leaking the memory >> allocated by pwmchip_alloc(). >> >> The simple way to solve this would be to call pwmchip_release() from here. > > Thanks, a pwmchip_release() is static though, so it's either expose the > pwmchip_release in the header, or call kfree() here directly on pwmchip. I'd export pwmchip_release() then, if you instead replicate what it does a future change is pretty likely to be missed in the Rust abstraction.