All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: Matthew Auld <matthew.auld@intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [Intel-gfx] [PATCH 2/2] drm/i915/selftests: fix smatch warning in mock_reserve
Date: Tue, 6 Jul 2021 15:13:27 +0530	[thread overview]
Message-ID: <20210706094327.GB23963@intel.com> (raw)
In-Reply-To: <20210702104642.1189978-2-matthew.auld@intel.com>

On 2021-07-02 at 11:46:42 +0100, Matthew Auld wrote:
> If mock_region_create fails then mem will be an error pointer. Instead
> we just need to use the correct ordering for the onion unwind.
> 
> igt_mock_reserve() error: 'mem' dereferencing possible ERR_PTR()
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/selftests/intel_memory_region.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/intel_memory_region.c b/drivers/gpu/drm/i915/selftests/intel_memory_region.c
> index 1aaccb9841a0..418caae84759 100644
> --- a/drivers/gpu/drm/i915/selftests/intel_memory_region.c
> +++ b/drivers/gpu/drm/i915/selftests/intel_memory_region.c
> @@ -173,7 +173,7 @@ static int igt_mock_reserve(void *arg)
>  	if (IS_ERR(mem)) {
>  		pr_err("failed to create memory region\n");
>  		err = PTR_ERR(mem);
> -		goto out_close;
> +		goto out_free_order;
>  	}
>  
>  	/* Reserve a bunch of ranges within the region */
> @@ -224,9 +224,10 @@ static int igt_mock_reserve(void *arg)
>  	}
>  
>  out_close:
> -	kfree(order);
>  	close_objects(mem, &objects);
>  	intel_memory_region_put(mem);
> +out_free_order:
> +	kfree(order);
LGTM.

Reviewed-by: Ramalingam C <ramalingam.c@intel.com>
>  	return err;
>  }
>  
> -- 
> 2.26.3
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Ramalingam C <ramalingam.c@intel.com>
To: Matthew Auld <matthew.auld@intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	kernel test robot <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH 2/2] drm/i915/selftests: fix smatch warning in mock_reserve
Date: Tue, 6 Jul 2021 15:13:27 +0530	[thread overview]
Message-ID: <20210706094327.GB23963@intel.com> (raw)
In-Reply-To: <20210702104642.1189978-2-matthew.auld@intel.com>

On 2021-07-02 at 11:46:42 +0100, Matthew Auld wrote:
> If mock_region_create fails then mem will be an error pointer. Instead
> we just need to use the correct ordering for the onion unwind.
> 
> igt_mock_reserve() error: 'mem' dereferencing possible ERR_PTR()
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/selftests/intel_memory_region.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/intel_memory_region.c b/drivers/gpu/drm/i915/selftests/intel_memory_region.c
> index 1aaccb9841a0..418caae84759 100644
> --- a/drivers/gpu/drm/i915/selftests/intel_memory_region.c
> +++ b/drivers/gpu/drm/i915/selftests/intel_memory_region.c
> @@ -173,7 +173,7 @@ static int igt_mock_reserve(void *arg)
>  	if (IS_ERR(mem)) {
>  		pr_err("failed to create memory region\n");
>  		err = PTR_ERR(mem);
> -		goto out_close;
> +		goto out_free_order;
>  	}
>  
>  	/* Reserve a bunch of ranges within the region */
> @@ -224,9 +224,10 @@ static int igt_mock_reserve(void *arg)
>  	}
>  
>  out_close:
> -	kfree(order);
>  	close_objects(mem, &objects);
>  	intel_memory_region_put(mem);
> +out_free_order:
> +	kfree(order);
LGTM.

Reviewed-by: Ramalingam C <ramalingam.c@intel.com>
>  	return err;
>  }
>  
> -- 
> 2.26.3
> 

  reply	other threads:[~2021-07-06  9:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-02 10:46 [Intel-gfx] [PATCH 1/2] drm/i915/selftests: fix smatch warning in igt_check_blocks Matthew Auld
2021-07-02 10:46 ` Matthew Auld
2021-07-02 10:46 ` [Intel-gfx] [PATCH 2/2] drm/i915/selftests: fix smatch warning in mock_reserve Matthew Auld
2021-07-02 10:46   ` Matthew Auld
2021-07-06  9:43   ` Ramalingam C [this message]
2021-07-06  9:43     ` Ramalingam C
2021-07-02 11:12 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/i915/selftests: fix smatch warning in igt_check_blocks Patchwork
2021-07-02 11:41 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-07-02 14:04 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-07-06  9:39 ` [Intel-gfx] [PATCH 1/2] " Ramalingam C
2021-07-06  9:39   ` Ramalingam C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210706094327.GB23963@intel.com \
    --to=ramalingam.c@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.