Re: [PATCH v3 08/14] drm/msm/mdp4: unwind a failed mdp4_kms_init()

From: Konrad Dybcio

Date: Mon Oct 26 2026 - 05:44:14 EST


On 10/24/26 1:19 AM, Dmitry Baryshkov wrote:
> mdp4_kms_init() returns straight away when one of its steps fails and
> lets the ->destroy() callback, which the caller runs afterwards, clean
> up. mdp4_destroy() however dereferences mdp4_kms->dev, which is only set
> after mdp_kms_init() has succeeded, so a failure there turns into a NULL
> pointer dereference. It also leaves the vdd regulator enabled.
>
> Set mdp4_kms->dev before anything can fail, undo the steps which have
> completed, in the reverse order, and tell the caller not to run
> ->destroy() after a failed init. Fold the hardware setup, which can't
> fail, into mdp4_kms_init().
>
> Fixes: 93c125e4ea98 ("drm/msm: don't tear down KMS twice when KMS init fails")
> Assisted-by: LLM
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
> ---

Acked-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>

Konrad