From: sashiko-bot@kernel.org
To: "Daniel Golle" <daniel@makrotopia.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6 07/13] drm/bridge: it6505: avoid division by zero in audio FS debug print
Date: Sat, 25 Jul 2026 03:16:23 +0000 [thread overview]
Message-ID: <20260725031623.C3E191F000E9@smtp.kernel.org> (raw)
In-Reply-To: <b3e19f2081a34df3814f766ab1ab95dc6f12a02d.1784947240.git.daniel@makrotopia.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Unhandled negative error code from it6505_read() is written back to REG_RESET_CTRL, inadvertently resetting the entire device.
- [High] Unhandled negative error codes from it6505_read_word() silently corrupt the video timing calculations.
--
--- Patch [7]: [PATCH v6 07/13] drm/bridge: it6505: avoid division by zero in audio FS debug print ---
commit fb85e4882527f59c0b49c06140294c57c71382ab
Author: Daniel Golle <daniel@makrotopia.org>
drm/bridge: it6505: avoid division by zero in audio FS debug print
This commit ensures the divisor is greater than zero before calculating and
printing the audio input frequency in the debug output. This prevents a division
by zero crash if the audio clock hasn't been latched and it6505_read() returns 0.
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index b7eb746c8f8e5..04711c8f4a041 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -1623,8 +1623,11 @@ static void it6505_enable_audio(struct it6505 *it6505)
> it6505_set_bits(it6505, REG_AUDIO_SRC_CTRL, AUDIO_FIFO_RESET, 0x00);
> it6505_set_bits(it6505, REG_RESET_CTRL, AUDIO_RESET, 0x00);
> regbe = it6505_read(it6505, REG_AUDIO_INPUT_FREQ);
> - DRM_DEV_DEBUG_DRIVER(dev, "regbe:0x%02x audio input fs: %d.%d kHz",
> - regbe, 6750 / regbe, (6750 % regbe) * 10 / regbe);
> + if (regbe > 0)
> + DRM_DEV_DEBUG_DRIVER(dev,
> + "regbe:0x%02x audio input fs: %d.%d kHz",
> + regbe, 6750 / regbe,
> + (6750 % regbe) * 10 / regbe);
> it6505_set_bits(it6505, REG_DATA_MUTE_CTRL, EN_AUD_MUTE, 0x00);
> }
[Severity: High]
This is a pre-existing issue, but I noticed another place where it6505_read()
errors might cause problems. In it6505_audio_input(), if an I2C read fails,
does this write the negative error code back to REG_RESET_CTRL?
drivers/gpu/drm/bridge/ite-it6505.c:it6505_audio_input() {
...
reg05 = it6505_read(it6505, REG_RESET_CTRL);
...
it6505_write(it6505, REG_RESET_CTRL, reg05);
...
}
If it6505_read() returns -19 (-ENODEV), the lower 8 bits (0xED) would set
both ALL_LOGIC_RESET (BIT 2) and VIDEO_RESET (BIT 0). Could this
unintentionally reset the entire hardware state machine?
[Severity: High]
This is also a pre-existing issue, but similar unhandled negative error codes
seem to be present in it6505_calc_video_info():
drivers/gpu/drm/bridge/ite-it6505.c:it6505_calc_video_info() {
...
htotal = it6505_read_word(it6505, REG_INPUT_HTOTAL) & 0x1FFF;
hdes = it6505_read_word(it6505, REG_INPUT_HACTIVE_START) & 0x1FFF;
...
}
If it6505_read_word() returns a negative error code (e.g. -19), would the
bitwise AND with 0x1FFF transform it into a large positive integer (e.g.
0x1FED)? Could these invalid values then corrupt the video timing state when
accumulated into the pixel clock calculations?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784947240.git.daniel@makrotopia.org?part=7
next prev parent reply other threads:[~2026-07-25 3:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-25 2:57 [PATCH v6 00/13] drm/bridge: it6505: DP audio support + shared-DAI hw_params fix Daniel Golle
2026-07-25 2:58 ` [PATCH v6 01/13] drm/bridge: it6505: quiesce event sources and work on remove() Daniel Golle
2026-07-25 3:23 ` sashiko-bot
2026-07-25 2:58 ` [PATCH v6 02/13] drm/bridge: it6505: balance and disable runtime PM on remove Daniel Golle
2026-07-25 3:18 ` sashiko-bot
2026-07-25 2:58 ` [PATCH v6 03/13] drm/bridge: it6505: unregister DP AUX adapter on bridge detach Daniel Golle
2026-07-25 3:17 ` sashiko-bot
2026-07-25 2:58 ` [PATCH v6 04/13] drm/bridge: it6505: complete poweroff even if disabling regulators fails Daniel Golle
2026-07-25 3:17 ` sashiko-bot
2026-07-25 2:58 ` [PATCH v6 05/13] drm/bridge: it6505: bail out of the IRQ handler when status reads fail Daniel Golle
2026-07-25 2:59 ` [PATCH v6 06/13] drm/bridge: it6505: avoid division by zero in pixel clock calculation Daniel Golle
2026-07-25 3:20 ` sashiko-bot
2026-07-25 2:59 ` [PATCH v6 07/13] drm/bridge: it6505: avoid division by zero in audio FS debug print Daniel Golle
2026-07-25 3:16 ` sashiko-bot [this message]
2026-07-25 2:59 ` [PATCH v6 08/13] drm/bridge: it6505: guard against zero channel count in audio infoframe Daniel Golle
2026-07-25 3:00 ` [PATCH v6 09/13] drm/bridge: it6505: hold endpoint OF node reference while parsing it Daniel Golle
2026-07-25 3:15 ` sashiko-bot
2026-07-25 3:00 ` [PATCH v6 10/13] drm/bridge: it6505: reject a too short link-frequencies property Daniel Golle
2026-07-25 3:00 ` [PATCH v6 11/13] drm/bridge: it6505: don't write an error code back to the reset register Daniel Golle
2026-07-25 3:19 ` sashiko-bot
2026-07-25 3:01 ` [PATCH v6 12/13] drm/bridge: it6505: Add audio support Daniel Golle
2026-07-25 5:25 ` sashiko-bot
2026-07-25 3:01 ` [PATCH v6 13/13] drm/bridge: it6505: Don't reject audio hw_params without an encoder Daniel Golle
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=20260725031623.C3E191F000E9@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.