[igt-dev] [PATCH i-g-t 05/21] tests: Use correct type for calloc

Kahola, Mika mika.kahola at intel.com
Wed Jan 16 11:28:02 UTC 2019


On Wed, 2019-01-16 at 13:20 +0200, Petri Latvala wrote:
> No actual difference, size of a pointer is the same as
> pointer-to-pointer.
> 

Reviewed-by: Mika Kahola <mika.kahola at intel.com>

> Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> Cc: Mika Kahola <mika.kahola at intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> ---
>  tests/kms_concurrent.c     | 2 +-
>  tests/kms_plane_multiple.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
> index c17b1fe6..af8ca70c 100644
> --- a/tests/kms_concurrent.c
> +++ b/tests/kms_concurrent.c
> @@ -61,7 +61,7 @@ static void test_init(data_t *data, enum pipe pipe,
> int n_planes,
>  	igt_plane_t *primary;
>  	int ret;
>  
> -	data->plane = calloc(n_planes, sizeof(data->plane));
> +	data->plane = calloc(n_planes, sizeof(*data->plane));
>  	igt_assert_f(data->plane != NULL, "Failed to allocate memory
> for planes\n");
>  
>  	data->fb = calloc(n_planes, sizeof(struct igt_fb));
> diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
> index 41024cb2..617054d9 100644
> --- a/tests/kms_plane_multiple.c
> +++ b/tests/kms_plane_multiple.c
> @@ -69,7 +69,7 @@ static void test_init(data_t *data, enum pipe pipe,
> int n_planes)
>  {
>  	data->pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe,
> INTEL_PIPE_CRC_SOURCE_AUTO);
>  
> -	data->plane = calloc(n_planes, sizeof(data->plane));
> +	data->plane = calloc(n_planes, sizeof(*data->plane));
>  	igt_assert_f(data->plane != NULL, "Failed to allocate memory
> for planes\n");
>  
>  	data->fb = calloc(n_planes, sizeof(struct igt_fb));


More information about the igt-dev mailing list