Skip to contentSkip to conversation

drm/i915/kunit: DP link: add fallback tests

bug report Dan Carpenter 2 participants 2 messages Aug 19

lore
Share & tools
lore
#0 lore raw

Hello Imre Deak,

Commit 4fee95d4f887 ("drm/i915/kunit: DP link: add fallback tests") from Jul 1, 2026 (linux-next), leads to the following Smatch static checker warning:

	drivers/gpu/drm/i915/display/tests/intel_dp_link_test.c:1223 get_fallback_config()
	warn: ignoring unreachable code.

drivers/gpu/drm/i915/display/tests/intel_dp_link_test.c

    1210 static bool get_fallback_config(const struct test_config_table *expected_table,
    1211                                 enum intel_output_type output_type,
    1212                                 const struct intel_dp_link_config *target_config,
    1213                                 struct intel_dp_link_config *fallback_config)
    1214 {
    1215         struct kunit *test = expected_table->test;
    1216         const struct link_config_set *config_set =
    1217                 get_fallback_configs_for_output_type(test, output_type);
    1218         int i;
    1219 
    1220         i = lookup_config(config_set, target_config);
    1221         KUNIT_ASSERT_GE(test, i, 0);
    1222 
--> 1223         for (i--; i >= 0; i--) {
    1224                 const struct intel_dp_link_config *config =
    1225                         &config_set->entries[i];
    1226 
    1227                 assert_config_is_supported(expected_table, config);
    1228                 *fallback_config = *config;
    1229 
    1230                 return true;

This return statement means this for loop doesn't loop.

    1231         }
    1232 
    1233         return false;
    1234 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

#1 lore raw

Hi Dan,

Quoted 32 lines · Dan Carpenter

Hello Imre Deak,

Commit 4fee95d4f887 ("drm/i915/kunit: DP link: add fallback tests") from Jul 1, 2026 (linux-next), leads to the following Smatch static checker warning:

	drivers/gpu/drm/i915/display/tests/intel_dp_link_test.c:1223 get_fallback_config()
	warn: ignoring unreachable code.

drivers/gpu/drm/i915/display/tests/intel_dp_link_test.c
1210 static bool get_fallback_config(const struct test_config_table *expected_table,

   1211                                 enum intel_output_type output_type,
   1212                                 const struct intel_dp_link_config *target_config,
   1213                                 struct intel_dp_link_config *fallback_config)
   1214 {
   1215         struct kunit *test = expected_table->test;
   1216         const struct link_config_set *config_set =
   1217                 get_fallback_configs_for_output_type(test, output_type);
   1218         int i;
   1219
   1220         i = lookup_config(config_set, target_config);
   1221         KUNIT_ASSERT_GE(test, i, 0);
   1222
--> 1223         for (i--; i >= 0; i--) {
   1224                 const struct intel_dp_link_config *config =
   1225                         &config_set->entries[i];
   1226
   1227                 assert_config_is_supported(expected_table, config);
   1228                 *fallback_config = *config;
   1229
   1230                 return true;
Quoted 1 line

This return statement means this for loop doesn't loop.

Same applies for get_target_config(); there is a fix under review for both [1].

BR,
Michał

[1] https://lore.kernel.org/intel-gfx/[email protected]

Quoted 11 lines
   1231         }
   1232
   1233         return false;
   1234 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter