Re: [PATCH 2/2] ASoC: spacemit: init *dp to NULL before error paths

Bui Duc Phuc <[email protected]> Tue, 4 Aug 2026 10:38:05 +0700
Newsgroups dev.linux.lists.spacemit,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound
Message-ID <CAABR9nGA0dft+MpoPJvvCYvDnZq0OKSNoF10+QUMxEakvz+2Ew@mail.gmail.com>
Hi Troy,

Thank you for your feedback.

> I still do not think this initialization is necessary. Currently,
> spacemit_i2s_init_dai() has exactly one failure path: devm_kmemdup() fails
> and the function returns -ENOMEM. The sole caller checks that return value
> and exits immediately.
>
> A caller that continued after ignoring the error would itself be incorrect
> and should not be accommodated. The helper is also static and has only this
> one caller, so there is no current API contract that requires the output to
> be initialized on failure.
>
> I suggest dropping this patch.

I agree. I'll drop this patch from the series.

Best regards,
Phuc