From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Kory Maincent" <kory.maincent@bootlin.com>
Cc: "Maxime Ripard" <mripard@kernel.org>,
"Douglas Anderson" <dianders@chromium.org>,
"Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
"Bajjuri Praneeth" <praneeth@ti.com>,
"Louis Chauvet" <louis.chauvet@bootlin.com>,
<stable@vger.kernel.org>, <thomas.petazzoni@bootlin.com>,
"Jyri Sarha" <jyri.sarha@iki.fi>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>
Subject: Re: [PATCH v3] drm/tilcdc: Fix removal actions in case of failed probe
Date: Mon, 24 Nov 2025 18:37:39 +0100 [thread overview]
Message-ID: <DEH3W0I9EBRB.16EYRXFT7K0ZS@bootlin.com> (raw)
In-Reply-To: <20251121112450.070fe238@kmaincent-XPS-13-7390>
Hi Köry,
On Fri Nov 21, 2025 at 11:24 AM CET, Kory Maincent wrote:
> On Wed, 19 Nov 2025 18:12:40 +0100
> "Luca Ceresoli" <luca.ceresoli@bootlin.com> wrote:
>
>> Hello Köry,
>>
>> On Tue Nov 18, 2025 at 2:38 PM CET, Kory Maincent wrote:
>> > From: "Kory Maincent (TI.com)" <kory.maincent@bootlin.com>
>> >
>> > The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers
>> > should only be called when the device has been successfully registered.
>> > Currently, these functions are called unconditionally in tilcdc_fini(),
>> > which causes warnings during probe deferral scenarios.
>> >
>> > [ 7.972317] WARNING: CPU: 0 PID: 23 at
>> > drivers/gpu/drm/drm_atomic_state_helper.c:175
>> > drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [ 8.005820]
>> > drm_atomic_helper_crtc_duplicate_state from
>> > drm_atomic_get_crtc_state+0x68/0x108 [ 8.005858]
>> > drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [
>> > 8.005885] drm_atomic_helper_disable_all from
>> > drm_atomic_helper_shutdown+0x90/0x144 [ 8.005911]
>> > drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [
>> > 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
>> >
>> > Fix this by rewriting the failed probe cleanup path using the standard
>> > goto error handling pattern, which ensures that cleanup functions are
>> > only called on successfully initialized resources. Additionally, remove
>> > the now-unnecessary is_registered flag.
>> >
>> > Cc: stable@vger.kernel.org
>> > Fixes: 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at
>> > shutdown/remove time for misc drivers") Signed-off-by: Kory Maincent
>> > (TI.com) <kory.maincent@bootlin.com>
>>
>> Except for the bug reported by the kernel test robot, this patch looks
>> good to me. Just a couple thoughts, below.
>>
>> > @@ -372,16 +371,34 @@ static int tilcdc_init(const struct drm_driver *ddrv,
>> > struct device *dev)
>> >
>> > ret = drm_dev_register(ddev, 0);
>> > if (ret)
>> > - goto init_failed;
>> > - priv->is_registered = true;
>> > + goto stop_poll;
>> >
>> > drm_client_setup_with_color_mode(ddev, bpp);
>> >
>> > return 0;
>> >
>> > -init_failed:
>> > - tilcdc_fini(ddev);
>> > +stop_poll:
>> > + drm_kms_helper_poll_fini(ddev);
>> > + tilcdc_irq_uninstall(ddev);
>> > +unbind_component:
>> > + if (priv->is_componentized)
>> > + component_unbind_all(dev, ddev);
>> > +unregister_cpufreq_notif:
>> > +#ifdef CONFIG_CPU_FREQ
>> > + cpufreq_unregister_notifier(&priv->freq_transition,
>> > + CPUFREQ_TRANSITION_NOTIFIER);
>> > +#endif
>> > +destroy_crtc:
>> > + tilcdc_crtc_destroy(priv->crtc);
>> > +disable_pm:
>> > + pm_runtime_disable(dev);
>> > + clk_put(priv->clk);
>> > +free_wq:
>> > + destroy_workqueue(priv->wq);
>> > +put_drm:
>> > platform_set_drvdata(pdev, NULL);
>>
>> I'm not 100% sure this is needed, but perhaps it is because of the
>> component framework being used.
>
> Yes not sure either but as it was already present I let it here.
> Do you think I should remove it?
At a quick look at the component framework, it does not seem to
care. However you are fixing a bug, so it's fine if you leave
platform_set_drvdata() untouched out of caution.
>> If it is needed, then shouldn't it be present in tilcdc_fini() as well?
>>
>> > + ddev->dev_private = NULL;
>> > + drm_dev_put(ddev);
>> >
>> > return ret;
>> > }
>>
>> About tilcdc_fini(), I think it can be itself cleaned up a lot (in another
>> patch). Basically it should do the same thing (almost) that are here below
>> the 'return 0' line, and in the same order. Now the list of actions is auite
>> different and the order is very different.
>
> Yes indeed, but this won't be a fix as there is no real issue in the remove
> AFAIK.
Sure! Cleaning up tilcdc_fini() would be a cleanup, not a bugfix, so you
can do it in a separate series without affecting this bugfix patch.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
prev parent reply other threads:[~2025-11-24 17:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 13:38 [PATCH v3] drm/tilcdc: Fix removal actions in case of failed probe Kory Maincent
2025-11-19 2:19 ` kernel test robot
2025-11-19 3:14 ` kernel test robot
2025-11-19 17:12 ` Luca Ceresoli
2025-11-21 10:24 ` Kory Maincent
2025-11-24 17:37 ` Luca Ceresoli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DEH3W0I9EBRB.16EYRXFT7K0ZS@bootlin.com \
--to=luca.ceresoli@bootlin.com \
--cc=airlied@gmail.com \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jyri.sarha@iki.fi \
--cc=kory.maincent@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=louis.chauvet@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=praneeth@ti.com \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox