Re: [PATCH v11 1/7] firmware: smccc: Add an Arm SMCCC bus
From: Jason Gunthorpe
Date: Tue Sep 15 2026 - 08:00:41 EST
On Tue, Sep 15, 2026 at 02:52:14PM +0530, Aneesh Kumar K.V wrote:
> > Yes, but as written it is OK, and this is a common pattern in the
> > kernel. I agree it is fragile tricky..
> >
> > Still it isn't an urgent reason to change it around, but the best
> > pattern is to put the allocate, dev.release=, and device_initialize()
> > in one 'alloc' function. Then the other function calls it and always
> > unwinds with put_device. Use device_add().
> >
> > This avoids mixing the different kfree/put_device error unwind regimes
> > into the same function..
> >
>
> Something like
Yeah, this is the safest way I know to use these interfaces
Jason