Re: [PATCH v2] i2c: cp2615: handle allocation failure

From: Bence Csókás

Date: Fri Aug 28 2026 - 08:13:01 EST


Hi,

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.

Bence