Re: [PATCH v2 6/6] soc: qcom: socinfo: Convert to Rust
From: Greg Kroah-Hartman
Date: Tue Feb 03 2026 - 11:52:10 EST
On Tue, Feb 03, 2026 at 05:35:24PM +0100, Danilo Krummrich wrote:
> On Tue Feb 3, 2026 at 5:28 PM CET, Greg Kroah-Hartman wrote:
> > On Tue, Feb 03, 2026 at 03:46:35PM +0000, Matthew Maurer wrote:
> >> +impl Smem {
> >> + pub(crate) fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Option<&'a Mmio> {
> >> + if *dev != *self.dev {
> >
> > How can this ever happen?
>
> You are right, since this resource is local to the driver, it should not be
> possible to have another devce from somewhere else (especially not a
> &Device<Bound>).
>
> However, from a Rust perspective I think not having this check would be unsound,
> as the method by itself would not be able guarantee correct behavor anymore.
>
I don't really understand this last sentence, sorry. If this is "not
possible" why would that at the same time be "unsound"?
thanks,
greg k-h