From: "Hogander, Jouni" <jouni.hogander@intel.com>
To: "Nikula, Jani" <jani.nikula@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 3/3] drm/i915/psr: clean up PSR debugfs sink status error handling
Date: Mon, 20 Mar 2023 08:50:49 +0000 [thread overview]
Message-ID: <a8ab03c1530624d768372f4d3aa82ebdf7973266.camel@intel.com> (raw)
In-Reply-To: <20230317134144.223936-3-jani.nikula@intel.com>
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@intel.com>
> Cc: Jouni Högander <jouni.hogander@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> 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;
> }
next prev parent reply other threads:[~2023-03-20 8:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 13:41 [Intel-gfx] [PATCH 1/3] drm/i915/psr: move PSR debugfs to intel_psr.c Jani Nikula
2023-03-17 13:41 ` [Intel-gfx] [PATCH 2/3] drm/i915/psr: switch PSR debugfs to struct intel_connector Jani Nikula
2023-03-20 8:50 ` Hogander, Jouni
2023-03-17 13:41 ` [Intel-gfx] [PATCH 3/3] drm/i915/psr: clean up PSR debugfs sink status error handling Jani Nikula
2023-03-20 8:50 ` Hogander, Jouni [this message]
2023-03-17 18:07 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915/psr: move PSR debugfs to intel_psr.c Patchwork
2023-03-17 18:07 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-03-17 18:07 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2023-03-17 18:20 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-03-17 20:54 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-03-20 8:50 ` [Intel-gfx] [PATCH 1/3] " Hogander, Jouni
2023-03-20 10:14 ` Jani Nikula
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=a8ab03c1530624d768372f4d3aa82ebdf7973266.camel@intel.com \
--to=jouni.hogander@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox