Re: [PATCH] sound: core: Check return value of device_create()

From: Takashi Iwai

Date: Tue Nov 24 2026 - 07:52:23 EST


On Mon, 23 Nov 2026 11:05:35 +0100,
Sreeraj S Kurup wrote:
>
> The sound_insert_unit() function ignores the return value of
> device_create(). If device creation fails, the function still
> returns the allocated minor number as if registration succeeded.
>
> Add a helper function, sound_device_create(), to create the sound
> device and check the return value using PTR_ERR_OR_ZERO().
>
> If device creation fails, remove the allocated sound unit from
> the sound loader list, unregister the character device when
> preclaim_oss is disabled, and free the allocated memory.
>
> Return the original error code to the caller instead of reporting
> successful registration.
>
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@xxxxxxxxx>

Applied to for-next branch. Thanks.


Takashi