All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Golle" <daniel@makrotopia.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 2/5] drm/bridge: it6505: disable runtime PM on remove
Date: Wed, 22 Jul 2026 01:21:24 +0000	[thread overview]
Message-ID: <20260722012125.0A4C51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <59d6066b37a33878c8673bf1659e16fd2624cae4.1784681487.git.daniel@makrotopia.org>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

Pre-existing issues:
- [High] The driver leaks the runtime PM usage counter if unbound while the DisplayPort cable is connected, breaking subsequent driver binds.
- [High] Resource registration asymmetry for the DRM DP AUX adapter causes registration failures on re-attach.
- [Medium] Missing error check on I2C reads in the IRQ handler causes negative error codes to be misinterpreted as phantom interrupts.
- [Low] The PM callback structure is assigned unconditionally, violating conditional compilation guidelines and creating dead code.
--

--- Patch [2]: [PATCH v4 2/5] drm/bridge: it6505: disable runtime PM on remove ---
commit 6b8ae3352685a773af0a6bbc5a90e489dc50ff6b
Author: Daniel Golle <daniel@makrotopia.org>

drm/bridge: it6505: disable runtime PM on remove

This commit disables runtime PM in the remove callback for the it6505 bridge
driver. It cancels work items before disabling runtime PM and powering off the
chip, which prevents the device from having an unbalanced disable depth after
unbind.

> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 7873ae6df3aff..2a8298ee6c03c 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -3655,6 +3655,7 @@ static void it6505_i2c_remove(struct i2c_client *client)
>  	cancel_work_sync(&it6505->hdcp_wait_ksv_list);
>  	cancel_delayed_work_sync(&it6505->hdcp_work);
>  	cancel_work_sync(&it6505->extcon_wq);
> +	pm_runtime_disable(&client->dev);

[Severity: High]
This is a pre-existing issue, but does the driver leak the runtime PM usage
counter if unbound while the DisplayPort cable is connected?

If the driver is unbound while a display is connected, it6505_extcon_work() has
previously called pm_runtime_get_sync() and elevated the PM usage counter.

The remove callback disables runtime PM via pm_runtime_disable() but fails to
drop the usage counter.

Because the usage count belongs to the struct device and persists across
bind/unbind cycles, a subsequent bind will start with an elevated usage count.
When extcon_work runs on the new bind, pm_runtime_get_sync() will return 1,
bypassing the it6505_poweron() sequence.

Can this cause the hardware to remain unpowered and all subsequent I2C
operations to fail?

>  	it6505_poweroff(it6505);
>  	it6505_remove_edid(it6505);
>  }

[Severity: High]
This is a pre-existing issue, but does the resource registration asymmetry for
the DRM DP AUX adapter cause registration failures on re-attach?

The driver registers the AUX channel via drm_dp_aux_register() in the
it6505_bridge_attach() callback, but unregisters it via
drm_dp_aux_unregister() in the I2C driver's it6505_i2c_remove() callback.

If the parent DRM device is unbound, the bridge is detached but the I2C driver
remains bound. When the DRM device is rebound, the bridge is attached again,
and drm_dp_aux_register() is called a second time on the same instance without
it having been unregistered.

Can this cause kernel warnings and registration failures in the I2C core?


[Severity: Medium]
This is a pre-existing issue, but can the missing error check on I2C reads in
the IRQ handler cause negative error codes to be misinterpreted as phantom
interrupts?

In it6505_int_threaded_handler(), the driver reads interrupt status registers
via it6505_read(). If the I2C read fails, it returns a negative error code:

    int_status[0] = it6505_read(it6505, INT_STATUS_01);
    int_status[1] = it6505_read(it6505, INT_STATUS_02);
    int_status[2] = it6505_read(it6505, INT_STATUS_03);

This negative integer is stored in the int_status array and passed to
it6505_test_bit(), which accesses it as an unsigned int.

Since a negative value has most of its bits set to 1, it6505_test_bit()
evaluates to true for multiple interrupt sources.

Does this cause spurious execution of interrupt sub-handlers and unpredictable
state changes?


[Severity: Low]
This is a pre-existing issue, but is the PM callback structure assigned
unconditionally?

In the it6505_i2c_driver structure, the .pm field is assigned directly to
&it6505_bridge_pm_ops.

According to the Power Management subsystem guidelines, this assignment should
be wrapped with the pm_ptr() macro to ensure the pointer becomes NULL when
CONFIG_PM is disabled.

Does this unconditional assignment create dead code and compiler warnings when
power management is disabled?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784681487.git.daniel@makrotopia.org?part=2

  reply	other threads:[~2026-07-22  1:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  0:58 [PATCH v4 0/5] drm/bridge: it6505: DP audio support + shared-DAI hw_params fix Daniel Golle
2026-07-22  0:59 ` [PATCH v4 1/5] drm/bridge: it6505: quiesce event sources and work on remove() Daniel Golle
2026-07-22  1:18   ` sashiko-bot
2026-07-22  0:59 ` [PATCH v4 2/5] drm/bridge: it6505: disable runtime PM on remove Daniel Golle
2026-07-22  1:21   ` sashiko-bot [this message]
2026-07-22  0:59 ` [PATCH v4 3/5] drm/bridge: it6505: guard against zero channel count in audio infoframe Daniel Golle
2026-07-22  1:16   ` sashiko-bot
2026-07-22  1:00 ` [PATCH v4 4/5] drm/bridge: it6505: Add audio support Daniel Golle
2026-07-22  1:15   ` sashiko-bot
2026-07-22  1:00 ` [PATCH v4 5/5] drm/bridge: it6505: Don't reject audio hw_params without an encoder Daniel Golle
2026-07-22  1:12   ` sashiko-bot

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=20260722012125.0A4C51F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.