Skip to contentSkip to conversation

kexec: Remove redundant assignments

PATCH Applied Michal Orzel 2 participants 2 messages Mar 26, 2022 – Mar 31, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kexec: Remove redundant assignments

Get rid of redundant assignments which end up in values not being read either because they are overwritten or the function ends.

Reported by clang-tidy [deadcode.DeadStores]

---
 kernel/kexec_core.c | 2 --
 1 file changed, 2 deletions(-)
kernel/kexec_core.c +0 -2
index 68480f731192..d08904a27362 100644
@@ -768,7 +768,6 @@ static struct page *kimage_alloc_page(struct kimage *image,
 				kimage_free_pages(old_page);
 				continue;
 			}
-			addr = old_addr;
 			page = old_page;
 			break;
 		}
@@ -788,7 +787,6 @@ static int kimage_load_normal_segment(struct kimage *image,
 	unsigned char __user *buf = NULL;
 	unsigned char *kbuf = NULL;
 
-	result = 0;
 	if (image->file_mode)
 		kbuf = segment->kbuf;
 	else
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Michal Orzel

Get rid of redundant assignments which end up in values not being read either because they are overwritten or the function ends.

Reported by clang-tidy [deadcode.DeadStores]

---
 kernel/kexec_core.c | 2 --
 1 file changed, 2 deletions(-)
kernel/kexec_core.c +0 -1
index 68480f731192..d08904a27362 100644
@@ -768,7 +768,6 @@ static struct page *kimage_alloc_page(struct kimage *image,
 				kimage_free_pages(old_page);
 				continue;
 			}
-			addr = old_addr;
 			page = old_page;
 			break;
 		}

kernel/kexec_core.c static int kimage_load_normal_segment(struct kimage *image, · line 792

Quoted 7 lines
kernel/kexec_core.c +0 -1
@@ -788,7 +787,6 @@ static int kimage_load_normal_segment(struct kimage *image,
 	unsigned char __user *buf = NULL;
 	unsigned char *kbuf = NULL;
 
-	result = 0;
 	if (image->file_mode)
 		kbuf = segment->kbuf;
 	else

LGTM, thx