mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 08:02:27 +02:00
drm/i915/psr: clean up PSR debugfs sink status error handling
Handle errors first and return early, and reduce indentation on the happy day code path. Cc: Jouni Högander <jouni.hogander@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Jouni Högander <jouni.hogander@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230317134144.223936-3-jani.nikula@intel.com
This commit is contained in:
parent
09b9851776
commit
e1435b67af
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user