All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vasilij Markin" <vasilij.kernel@tototo.si>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/appletbdrm: Add suspend and resume support
Date: Thu, 24 Sep 2026 19:33:24 +0000	[thread overview]
Message-ID: <20260924193325.9B7991F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260924-appletbdrm-pm-v1-1-0e5432132161@tototo.si>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/appletbdrm: Memory leak of suspend_state on reset_resume error
--

commit 60e19da684ddfb4bbf66c6f0c2624ed415d96f12
Author: Vasilij Markin <vasilij.kernel@tototo.si>
Subject: drm/appletbdrm: Add suspend and resume support

This commit introduces suspend and resume support for the appletbdrm driver.
It uses drm_mode_config_helper_suspend() and drm_mode_config_helper_resume()
to keep the device registered across cycles. In case the device was reset while
suspended, it repeats the probe-time handshake.

> diff --git a/drivers/gpu/drm/tiny/appletbdrm.c b/drivers/gpu/drm/tiny/appletbdrm.c
> index 4297d9c1125e4..024ad8bf6e1c4 100644
> --- a/drivers/gpu/drm/tiny/appletbdrm.c
> +++ b/drivers/gpu/drm/tiny/appletbdrm.c
[ ... ]
> @@ -821,6 +822,45 @@ static void appletbdrm_shutdown(struct usb_interface *intf)
>  	drm_atomic_helper_shutdown(&adev->drm);
>  }
>  
> +static int appletbdrm_suspend(struct usb_interface *intf, pm_message_t message)
> +{
> +	struct appletbdrm_device *adev = usb_get_intfdata(intf);
> +
> +	return drm_mode_config_helper_suspend(&adev->drm);
> +}
> +
> +static int appletbdrm_resume(struct usb_interface *intf)
> +{
> +	struct appletbdrm_device *adev = usb_get_intfdata(intf);
> +
> +	return drm_mode_config_helper_resume(&adev->drm);
> +}
> +
> +static int appletbdrm_reset_resume(struct usb_interface *intf)
> +{
> +	struct appletbdrm_device *adev = usb_get_intfdata(intf);
> +	struct drm_device *drm = &adev->drm;
> +	int ret;
> +
> +	/*
> +	 * A reset puts the device back into its initial state, where it
> +	 * expects the same handshake as during probe
> +	 */
> +	ret = appletbdrm_get_information(adev);
> +	if (ret) {
> +		drm_err(drm, "Failed to get display information\n");
> +		return ret;

[Severity: Medium]
During system suspend, drm_mode_config_helper_suspend() duplicates the atomic
commit state and stores it in dev->mode_config.suspend_state.

If appletbdrm_get_information() fails here, we return early and bypass the call
to drm_mode_config_helper_resume(). Does this leak the suspend_state and its
associated DRM object references, since they never get freed or put by
drm_atomic_state_put()?

> +	}
> +
> +	ret = appletbdrm_signal_readiness(adev);
> +	if (ret) {
> +		drm_err(drm, "Failed to signal readiness\n");
> +		return ret;

[Severity: Medium]
Similar to the issue above, if appletbdrm_signal_readiness() fails, does
returning early without calling drm_mode_config_helper_resume() leak the atomic
commit state stored in dev->mode_config.suspend_state?

> +	}
> +
> +	return drm_mode_config_helper_resume(drm);
> +}
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260924-appletbdrm-pm-v1-1-0e5432132161@tototo.si?part=1

  reply	other threads:[~2026-09-24 19:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 19:25 [PATCH] drm/appletbdrm: Add suspend and resume support Vasilij Markin
2026-09-24 19:25 ` Vasilij Markin via B4 Relay
2026-09-24 19:33 ` sashiko-bot [this message]
2026-09-25 11:51 ` Aditya Garg
2026-10-04 12:06 ` [PATCH v2] " Aditya Garg
2026-10-04 12:19   ` sashiko-bot
2026-10-07 14:20   ` Aditya Garg

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=20260924193325.9B7991F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vasilij.kernel@tototo.si \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.