diff mbox series

[v2,2/2] drm/bridge: anx7625: Propagate errors from sp_tx_edid_read()

Message ID 20210818171318.1848272-2-robert.foss@linaro.org (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] drm/bridge: anx7625: Propagate errors from sp_tx_rst_aux() | expand

Commit Message

Robert Foss Aug. 18, 2021, 5:13 p.m. UTC
During the sp_tx_edid_read() call the return value of sp_tx_edid_read()
is ignored, which could cause potential errors to go unhandled.

All errors which are returned by sp_tx_edid_read() are handled in
anx7625_get_edid().

Signed-off-by: Robert Foss <robert.foss@linaro.org>
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Sam Ravnborg Aug. 18, 2021, 5:40 p.m. UTC | #1
Hi Robert,

On Wed, Aug 18, 2021 at 07:13:18PM +0200, Robert Foss wrote:
> During the sp_tx_edid_read() call the return value of sp_tx_edid_read()
> is ignored, which could cause potential errors to go unhandled.
> 
> All errors which are returned by sp_tx_edid_read() are handled in
> anx7625_get_edid().
> 
> Signed-off-by: Robert Foss <robert.foss@linaro.org>
> ---
>  drivers/gpu/drm/bridge/analogix/anx7625.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index ea414cd349b5c..abc8db77bfd36 100644
> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> @@ -845,8 +845,11 @@ static int sp_tx_edid_read(struct anx7625_data *ctx,
>  				if (g_edid_break == 1)
>  					break;
>  
> -				segments_edid_read(ctx, count / 2,
> -						   pblock_buf, offset);
> +				ret = segments_edid_read(ctx, count / 2,
> +							 pblock_buf, offset);
> +				if (ret < 0)
> +					return ret;
> +

This could be just "if (ret)".
Same goes for the next case.

With or without this simplification:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

I assume you will apply the patches.

	Sam

>  				memcpy(&pedid_blocks_buf[edid_pos],
>  				       pblock_buf,
>  				       MAX_DPCD_BUFFER_SIZE);
> @@ -863,8 +866,11 @@ static int sp_tx_edid_read(struct anx7625_data *ctx,
>  				if (g_edid_break == 1)
>  					break;
>  
> -				segments_edid_read(ctx, count / 2,
> -						   pblock_buf, offset);
> +				ret = segments_edid_read(ctx, count / 2,
> +							 pblock_buf, offset);
> +				if (ret < 0)
> +					return ret;
> +
>  				memcpy(&pedid_blocks_buf[edid_pos],
>  				       pblock_buf,
>  				       MAX_DPCD_BUFFER_SIZE);
> -- 
> 2.30.2
Robert Foss Aug. 18, 2021, 7:02 p.m. UTC | #2
Thanks Sam!

On Wed, 18 Aug 2021 at 19:40, Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Robert,
>
> On Wed, Aug 18, 2021 at 07:13:18PM +0200, Robert Foss wrote:
> > During the sp_tx_edid_read() call the return value of sp_tx_edid_read()
> > is ignored, which could cause potential errors to go unhandled.
> >
> > All errors which are returned by sp_tx_edid_read() are handled in
> > anx7625_get_edid().
> >
> > Signed-off-by: Robert Foss <robert.foss@linaro.org>
> > ---
> >  drivers/gpu/drm/bridge/analogix/anx7625.c | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > index ea414cd349b5c..abc8db77bfd36 100644
> > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > @@ -845,8 +845,11 @@ static int sp_tx_edid_read(struct anx7625_data *ctx,
> >                               if (g_edid_break == 1)
> >                                       break;
> >
> > -                             segments_edid_read(ctx, count / 2,
> > -                                                pblock_buf, offset);
> > +                             ret = segments_edid_read(ctx, count / 2,
> > +                                                      pblock_buf, offset);
> > +                             if (ret < 0)
> > +                                     return ret;
> > +
>
> This could be just "if (ret)".
> Same goes for the next case.
>
> With or without this simplification:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
>
> I assume you will apply the patches.

Applied to drm-misc-next
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index ea414cd349b5c..abc8db77bfd36 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -845,8 +845,11 @@  static int sp_tx_edid_read(struct anx7625_data *ctx,
 				if (g_edid_break == 1)
 					break;
 
-				segments_edid_read(ctx, count / 2,
-						   pblock_buf, offset);
+				ret = segments_edid_read(ctx, count / 2,
+							 pblock_buf, offset);
+				if (ret < 0)
+					return ret;
+
 				memcpy(&pedid_blocks_buf[edid_pos],
 				       pblock_buf,
 				       MAX_DPCD_BUFFER_SIZE);
@@ -863,8 +866,11 @@  static int sp_tx_edid_read(struct anx7625_data *ctx,
 				if (g_edid_break == 1)
 					break;
 
-				segments_edid_read(ctx, count / 2,
-						   pblock_buf, offset);
+				ret = segments_edid_read(ctx, count / 2,
+							 pblock_buf, offset);
+				if (ret < 0)
+					return ret;
+
 				memcpy(&pedid_blocks_buf[edid_pos],
 				       pblock_buf,
 				       MAX_DPCD_BUFFER_SIZE);