[PATCH 5/6] video: edid: print debug message on EDID read out error
Marco Felsch
m.felsch at pengutronix.de
Fri Dec 23 01:06:05 PST 2022
Hi Ahmad,
On 22-12-22, Ahmad Fatoum wrote:
> EDID readout errors happen often, e.g. because the HDMI port doesn't
> have a display connected. However, when a monitor is connected, but some
> other error occurs, barebox is silent. Add a debug message with an error
> code for this.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> drivers/video/edid.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/edid.c b/drivers/video/edid.c
> index 96489f2a372c..7e6747ccd521 100644
> --- a/drivers/video/edid.c
> +++ b/drivers/video/edid.c
> @@ -847,20 +847,27 @@ edid_do_read_i2c(struct i2c_adapter *adapter, unsigned char *buf,
> ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
> } while (ret != xfers && --retries);
>
> - return ret == xfers ? 0 : -1;
> + if (ret == 0)
When does the i2c_transfer() return 0? According the API documentation
this shouldn't happen and if otherwise is a bug in i2c_transfer().
Regards,
Marco
> + ret = -EPROTO;
> +
> + return ret == xfers ? 0 : ret;
> }
>
> void *edid_read_i2c(struct i2c_adapter *adapter)
> {
> u8 *block;
> + int ret;
>
> if (!IS_ENABLED(CONFIG_I2C))
> return NULL;
>
> block = xmalloc(EDID_LENGTH);
>
> - if (edid_do_read_i2c(adapter, block, 0, EDID_LENGTH))
> + ret = edid_do_read_i2c(adapter, block, 0, EDID_LENGTH);
> + if (ret) {
> + dev_dbg(&adapter->dev, "EDID readout failed: %pe\n", ERR_PTR(ret));
> goto out;
> + }
>
> return block;
> out:
> --
> 2.30.2
>
>
>
More information about the barebox
mailing list