From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Colin Ian King <colin.i.king@gmail.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/gem: remove redundant assignments to variable ret
Date: Mon, 10 Oct 2022 09:07:41 +0100 [thread overview]
Message-ID: <732c7a7d-2851-4ac0-cd7a-6f9a2f3df50a@linux.intel.com> (raw)
In-Reply-To: <20221007194745.2749277-1-colin.i.king@gmail.com>
On 07/10/2022 20:47, Colin Ian King wrote:
> The variable ret is being assigned with a value that is never read
> both before and after a while-loop. The variable is being re-assigned
> inside the while-loop and afterwards on the call to the function
> i915_gem_object_lock_interruptible. Remove the redundants assignments.
>
> Cleans up clang scan-build warnings:
>
> warning: Although the value stored to 'ret' is used in the
> enclosing expression, the value is never actually read
> from 'ret' [deadcode.DeadStores]
>
> warning: Value stored to 'ret' is never read [deadcode.DeadStores]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
> index d4398948f016..b7e24476a0fd 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
> @@ -292,7 +292,7 @@ int i915_gem_object_userptr_submit_init(struct drm_i915_gem_object *obj)
> if (!i915_gem_object_is_readonly(obj))
> gup_flags |= FOLL_WRITE;
>
> - pinned = ret = 0;
> + pinned = 0;
> while (pinned < num_pages) {
> ret = pin_user_pages_fast(obj->userptr.ptr + pinned * PAGE_SIZE,
> num_pages - pinned, gup_flags,
> @@ -302,7 +302,6 @@ int i915_gem_object_userptr_submit_init(struct drm_i915_gem_object *obj)
>
> pinned += ret;
> }
> - ret = 0;
>
> ret = i915_gem_object_lock_interruptible(obj, NULL);
> if (ret)
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Thanks for the cleanup, will merge.
Regards,
Tvrtko
prev parent reply other threads:[~2022-10-10 8:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 19:47 [Intel-gfx] [PATCH] drm/i915/gem: remove redundant assignments to variable ret Colin Ian King
2022-10-07 20:53 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-10-08 1:57 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-10-10 8:07 ` Tvrtko Ursulin [this message]
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=732c7a7d-2851-4ac0-cd7a-6f9a2f3df50a@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=airlied@gmail.com \
--cc=colin.i.king@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox