Sure,i'll follow your suggestion in v3 patch:
1. set new to NULL
2. add a 'if' judgment before 'kmem_cache_create'
Thanks,
Kunwu
On 2023/12/1 18:17, Michael Ellerman wrote:
avoid two calls to panic
Kunwu Chan writes:
> kasprintf() returns a pointer to dynamically allocated memory
> which can be NULL upon failure. Ensure the allocation was successful
> by checking the pointer validity.
>
> Suggested-by: Christophe Leroy
> Suggested-by: Michael Ellerman
> Signed-off-by: Kunwu Chan
> ---
>
kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.
Suggested-by: Christophe Leroy
Suggested-by: Michael Ellerman
Signed-off-by: Kunwu Chan
---
v2: Use "panic" instead of "return"