Re: [PATCH v5 3/3] drm/msm: stop storing the array of CRTCs in struct msm_drm_private

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 17 Jun 2022 at 23:52, Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
>
> Quoting Dmitry Baryshkov (2022-06-17 12:14:29)
> > diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> > index 44485363f37a..567e77dae43b 100644
> > --- a/drivers/gpu/drm/msm/msm_drv.c
> > +++ b/drivers/gpu/drm/msm/msm_drv.c
> > @@ -427,20 +428,23 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
> >         ddev->mode_config.funcs = &mode_config_funcs;
> >         ddev->mode_config.helper_private = &mode_config_helper_funcs;
> >
> > -       for (i = 0; i < priv->num_crtcs; i++) {
> > +       drm_for_each_crtc(crtc, ddev) {
> > +               struct msm_drm_thread *ev_thread;
> > +
> >                 /* initialize event thread */
> > -               priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id;
> > -               priv->event_thread[i].dev = ddev;
> > -               priv->event_thread[i].worker = kthread_create_worker(0,
> > -                       "crtc_event:%d", priv->event_thread[i].crtc_id);
> > -               if (IS_ERR(priv->event_thread[i].worker)) {
> > -                       ret = PTR_ERR(priv->event_thread[i].worker);
> > +               ev_thread = &priv->event_thread[drm_crtc_index(crtc)];
> > +               ev_thread->crtc = crtc;
> > +               ev_thread->dev = ddev;
> > +               ev_thread->worker = kthread_create_worker(0,
> > +                       "crtc_event:%d", ev_thread->crtc->base.id);
> > +               if (IS_ERR(ev_thread->worker)) {
> > +                       ret = PTR_ERR(ev_thread->worker);
> >                         DRM_DEV_ERROR(dev, "failed to create crtc_event kthread\n");
> > -                       ret = PTR_ERR(priv->event_thread[i].worker);
> > +                       ev_thread->worker = NULL;
>
> This wasn't set to NULL before, so is it necessary to set it to NULL
> now?

The msm_drm_uninit() will loop over the event_thread array and try to
cleanup workers. However if the ev_thread->worker contains the error
code, then we risk getting an oops.

Let me take another glance onto this code and split this into a
separate fixup patch.

-- 
With best wishes
Dmitry



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux