[PATCH] drm/meson: add check to prevent dereference of NULL
Martin Blumenstingl
martin.blumenstingl at googlemail.com
Sat Aug 10 09:09:40 UTC 2024
Hello Anastasia,
Thank you for working on this!
On Fri, Aug 9, 2024 at 2:48 PM Anastasia Belova <abelova at astralinux.ru> wrote:
[...]
> @@ -373,9 +373,11 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
> free_drm:
> drm_dev_put(drm);
>
> - meson_encoder_dsi_remove(priv);
> - meson_encoder_hdmi_remove(priv);
> - meson_encoder_cvbs_remove(priv);
> + if (priv) {
> + meson_encoder_dsi_remove(priv);
> + meson_encoder_hdmi_remove(priv);
> + meson_encoder_cvbs_remove(priv);
> + }
This is the straight-forward approach.
There's been conversions from non-devm_ functions to their devm_*
counterparts in the past in various subsystems.
I just found that there's a devm_drm_dev_alloc() which seems to be
calling drm_dev_put() automatically - but I have never used it myself
before.
As an alternative to your suggested approach: could you please look
into whether devm_drm_dev_alloc() is a suitable replacement (if not:
just explain why - then this patch is good to be merged)?
Thank you!
Martin
More information about the dri-devel
mailing list