linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hv_balloon: Remove redundant assignment to region_start
@ 2021-04-29 10:21 Jiapeng Chong
  2021-05-04 12:54 ` Wei Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-04-29 10:21 UTC (permalink / raw)
  To: kys
  Cc: haiyangz, sthemmin, wei.liu, linux-hyperv, linux-kernel, Jiapeng Chong

Variable region_start is set to pg_start but this value is never
read as it is overwritten later on, hence it is a redundant
assignment and can be removed.

Cleans up the following clang-analyzer warning:

drivers/hv/hv_balloon.c:1013:3: warning: Value stored to 'region_start'
is never read [clang-analyzer-deadcode.DeadStores].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/hv/hv_balloon.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 58af84e..7f11ea0 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -1010,7 +1010,6 @@ static void hot_add_req(struct work_struct *dummy)
 		 * that need to be hot-added while ensuring the alignment
 		 * and size requirements of Linux as it relates to hot-add.
 		 */
-		region_start = pg_start;
 		region_size = (pfn_cnt / HA_CHUNK) * HA_CHUNK;
 		if (pfn_cnt % HA_CHUNK)
 			region_size += HA_CHUNK;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hv_balloon: Remove redundant assignment to region_start
  2021-04-29 10:21 [PATCH] hv_balloon: Remove redundant assignment to region_start Jiapeng Chong
@ 2021-05-04 12:54 ` Wei Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Wei Liu @ 2021-05-04 12:54 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: kys, haiyangz, sthemmin, wei.liu, linux-hyperv, linux-kernel

On Thu, Apr 29, 2021 at 06:21:21PM +0800, Jiapeng Chong wrote:
> Variable region_start is set to pg_start but this value is never
> read as it is overwritten later on, hence it is a redundant
> assignment and can be removed.

Indeed. It is overwritten a few lines below.

> 
> Cleans up the following clang-analyzer warning:
> 
> drivers/hv/hv_balloon.c:1013:3: warning: Value stored to 'region_start'
> is never read [clang-analyzer-deadcode.DeadStores].
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Applied to hyperv-next. Thanks.

Wei.

> ---
>  drivers/hv/hv_balloon.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index 58af84e..7f11ea0 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -1010,7 +1010,6 @@ static void hot_add_req(struct work_struct *dummy)
>  		 * that need to be hot-added while ensuring the alignment
>  		 * and size requirements of Linux as it relates to hot-add.
>  		 */
> -		region_start = pg_start;
>  		region_size = (pfn_cnt / HA_CHUNK) * HA_CHUNK;
>  		if (pfn_cnt % HA_CHUNK)
>  			region_size += HA_CHUNK;
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-04 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 10:21 [PATCH] hv_balloon: Remove redundant assignment to region_start Jiapeng Chong
2021-05-04 12:54 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).