Re: [PATCH 3/3] drm/i915/psr: clean up PSR debugfs sink status error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2023-03-17 at 15:41 +0200, Jani Nikula wrote:
> Handle errors first and return early, and reduce indentation on the
> happy day code path.
> 

Reviewed-by: Jouni Högander <jouni.hogander@xxxxxxxxx>

> Cc: Jouni Högander <jouni.hogander@xxxxxxxxx>
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/display/intel_psr.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> b/drivers/gpu/drm/i915/display/intel_psr.c
> index bd1a1a2524b5..31084d95711d 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -2891,6 +2891,7 @@ static int i915_psr_sink_status_show(struct
> seq_file *m, void *data)
>                 "reserved",
>                 "sink internal error",
>         };
> +       const char *str;
>         int ret;
>         u8 val;
>  
> @@ -2903,17 +2904,16 @@ static int i915_psr_sink_status_show(struct
> seq_file *m, void *data)
>                 return -ENODEV;
>  
>         ret = drm_dp_dpcd_readb(&intel_dp->aux, DP_PSR_STATUS, &val);
> +       if (ret != 1)
> +               return ret < 0 ? ret : -EIO;
>  
> -       if (ret == 1) {
> -               const char *str = "unknown";
> +       val &= DP_PSR_SINK_STATE_MASK;
> +       if (val < ARRAY_SIZE(sink_status))
> +               str = sink_status[val];
> +       else
> +               str = "unknown";
>  
> -               val &= DP_PSR_SINK_STATE_MASK;
> -               if (val < ARRAY_SIZE(sink_status))
> -                       str = sink_status[val];
> -               seq_printf(m, "Sink PSR status: 0x%x [%s]\n", val,
> str);
> -       } else {
> -               return ret;
> -       }
> +       seq_printf(m, "Sink PSR status: 0x%x [%s]\n", val, str);
>  
>         return 0;
>  }





[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux