Re: [PATCH v2] i2c: cp2615: handle allocation failure
From: Andi Shyti
Date: Fri Aug 28 2026 - 13:12:23 EST
On Fri, Aug 28, 2026 at 02:08:19PM +0200, Bence Csókás wrote:
> On 8/18/26 13:17, Triet Hoang wrote:
> > Check the result of kzalloc_obj() and return -ENOMEM
> > when the allocation fails instead of passing a NULL pointer
> > to the message initialization helpers, which would return -EINVAL.
> >
> > Signed-off-by: Triet Hoang <triet.hoang.dev@xxxxxxxxx>
> Just change the -EINVAL to -ENOMEM. This is something which has been
> discussed before [1] as a potential to-do.
>
> [1] https://lore.kernel.org/lkml/CACCVKEFXOKhXmF3rcmKQ8-aMFZJLZOf+imsuBYKAQsWptrJG6Q@xxxxxxxxxxxxxx/
>
> On 8/19/26 08:28, Markus Elfring wrote:
> > * How do you think about to increase the application of scope-based
> resource management?
>
> I second this, this old code could use some RAII modernization.
is there a managed version for kzalloc_obj()?
Andi