Re: [PATCH v9 22/22] drm/bridge: synopsys: dw-dp: Add audio support
[email protected] Mon, 03 Aug 2026 19:11:24 +0000
| Newsgroups | org.freedesktop.lists.dri-devel,org.kernel.vger.linux-devicetree |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] The result of regmap_read() is used without checking its return = value, potentially leading to the use of uninitialized stack memory. -- --- Patch [22]: [PATCH v9 22/22] drm/bridge: synopsys: dw-dp: Add audio sup= port --- commit f36ed9436eafc188ce4405c443eb47147a26dbd1 Author: Sebastian Reichel <[email protected]> drm/bridge: synopsys: dw-dp: Add audio support This commit implements audio support for the Synopsys DesignWare DisplayPort controller. > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/br= idge/synopsys/dw-dp.c > --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c [ ... ] > @@ -1690,6 +1721,254 @@ static int dw_dp_link_enable(struct dw_dp *dp) [ ... ] > +static int dw_dp_audio_prepare(struct drm_bridge *bridge, > + struct drm_connector *connector, > + struct hdmi_codec_daifmt *daifmt, > + struct hdmi_codec_params *params) > +{ > + struct dw_dp *dp =3D bridge_to_dp(bridge); > + u8 supported_audio_interfaces; > + enum dw_dp_audio_interface audio_interface; > + u32 cfg1; > + int ret; [ ... ] > + switch (daifmt->fmt) { > + case HDMI_SPDIF: > + audio_interface =3D DW_DP_AUDIO_SPDIF; > + break; > + case HDMI_I2S: > + /* > + * It is recommended to use SPDIF instead of I2S, since I2S mode requi= res > + * manually inserting PCUV control bits from userspace and this is done > + * automatically in hardware for SPDIF mode. > + */ > + audio_interface =3D DW_DP_AUDIO_I2S; > + break; > + default: > + dev_err(dp->dev, "invalid DAI format %d\n", daifmt->fmt); > + return -EINVAL; > + } > + > + regmap_read(dp->regmap, DW_DP_CONFIG_REG1, &cfg1); > + supported_audio_interfaces =3D FIELD_GET(AUDIO_SELECT, cfg1); [Severity: Medium] Is it possible for regmap_read() to fail here? If the read operation fails, cfg1 would remain uninitialized, causing FIELD_GET() to operate on uninitialized stack memory.=20 Should the return value of regmap_read() be checked before accessing cfg1? > + > + if (supported_audio_interfaces !=3D DW_DP_AUDIO_I2S_AND_SPDIF && > + supported_audio_interfaces !=3D audio_interface) { > + dev_err(dp->dev, "unsupported DAI %d\n", daifmt->fmt); > + return -EINVAL; > + } [ ... ] --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260803-synopsys-d= [email protected]?part=3D22