[PATCH i-g-t 2/2] tests/intel: check drmModeGetConnector() return value in i915_pm_rpm
Luca Coelho
luca at coelho.fi
Tue May 28 07:41:21 UTC 2024
On Thu, 2024-05-23 at 12:24 +0200, Kamil Konieczny wrote:
> Hi Luca,
> On 2024-05-23 at 11:44:26 +0300, Luca Coelho wrote:
> > The drmModeGetConnector() function can return NULL in some cases, so
> > we need to check the return value before accessing it. This is not
> > being checked in init_mode_set_data(), so fix that.
> >
> > Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10911
> > Signed-off-by: Luca Coelho <luciano.coelho at intel.com>
> > ---
> > tests/intel/i915_pm_rpm.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/tests/intel/i915_pm_rpm.c b/tests/intel/i915_pm_rpm.c
> > index 52e00489da70..10a545f173de 100644
> > --- a/tests/intel/i915_pm_rpm.c
> > +++ b/tests/intel/i915_pm_rpm.c
> > @@ -515,6 +515,12 @@ static void init_mode_set_data(struct mode_set_data *data)
> > data->connectors[i] =
> > drmModeGetConnector(drm_fd,
> > data->res->connectors[i]);
> > + if (!data->connectors[i]) {
> > + igt_warn("Could not read connector %u\n",
> --------------------^^^^
> Why warn? imho igt_debug would be better.
We would previously crash here, which is a test failure. I think a
warn would also cause the test to fail, but in a more graceful way. I
considered using igt_debug(), but thought that at least for now the
test should fail when this happens. But I'll change it to igt_debug(),
as you asked.
--
Cheers,
Luca.
More information about the igt-dev
mailing list