diff mbox series

drm/tests: probe_helper: Fix unitialized variable

Message ID 20221201090736.290935-1-maxime@cerno.tech (mailing list archive)
State New, archived
Headers show
Series drm/tests: probe_helper: Fix unitialized variable | expand

Commit Message

Maxime Ripard Dec. 1, 2022, 9:07 a.m. UTC
The len variable is used while uninitialized. Initialize it.

Fixes: 1e4a91db109f ("drm/probe-helper: Provide a TV get_modes helper")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/tests/drm_probe_helper_test.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Javier Martinez Canillas Dec. 1, 2022, 9:57 a.m. UTC | #1
On 12/1/22 10:07, Maxime Ripard wrote:
> The len variable is used while uninitialized. Initialize it.
> 
> Fixes: 1e4a91db109f ("drm/probe-helper: Provide a TV get_modes helper")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/gpu/drm/tests/drm_probe_helper_test.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/tests/drm_probe_helper_test.c b/drivers/gpu/drm/tests/drm_probe_helper_test.c
> index 7e938258c742..211131405500 100644
> --- a/drivers/gpu/drm/tests/drm_probe_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_probe_helper_test.c
> @@ -115,6 +115,7 @@ drm_test_connector_helper_tv_get_modes_check(struct kunit *test)
>  	ret = drm_connector_helper_tv_get_modes(connector);
>  	KUNIT_EXPECT_EQ(test, ret, params->num_expected_modes);
>  
> +	len = 0;

I would probably do `size_t len = 0;` instead but don't have a strong opinion.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Maxime Ripard Dec. 1, 2022, 10:18 a.m. UTC | #2
On Thu, 1 Dec 2022 10:07:36 +0100, Maxime Ripard wrote:
> The len variable is used while uninitialized. Initialize it.
> 
> 

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tests/drm_probe_helper_test.c b/drivers/gpu/drm/tests/drm_probe_helper_test.c
index 7e938258c742..211131405500 100644
--- a/drivers/gpu/drm/tests/drm_probe_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_probe_helper_test.c
@@ -115,6 +115,7 @@  drm_test_connector_helper_tv_get_modes_check(struct kunit *test)
 	ret = drm_connector_helper_tv_get_modes(connector);
 	KUNIT_EXPECT_EQ(test, ret, params->num_expected_modes);
 
+	len = 0;
 	list_for_each_entry(mode, &connector->probed_modes, head)
 		len++;
 	KUNIT_EXPECT_EQ(test, len, params->num_expected_modes);