Skip to contentSkip to conversation

mm/hugetlb.c: remove dead store in demote_size_show()

PATCH In review Nghia Le 2 participants 2 messages Oct 2, 2021 – Oct 3, 2021

Subsystems (2)
lore
Share & tools
lore

Nghia Le

author
#0 lore raw

PATCH v2 1/1 mm/hugetlb.c: remove dead store in demote_size_show()

The command "make clang-analyzer" detected a dead store.

Remove demote_size and corresponding assignment in function demote_size_show() to fix dead store, as demote_size is never read

---
 mm/hugetlb.c | 2 --
 1 file changed, 2 deletions(-)
mm/hugetlb.c +0 -2
index 993efa70bce4..ef00e6ad0f6a 100644
@@ -3706,11 +3706,9 @@ static ssize_t demote_size_show(struct kobject *kobj,
 					struct kobj_attribute *attr, char *buf)
 {
 	struct hstate *h;
-	unsigned long demote_size;
 	int nid;
 
 	h = kobj_to_hstate(kobj, &nid);
-	demote_size = h->demote_order;
 
 	return sysfs_emit(buf, "%lukB\n",
 			(unsigned long)(PAGE_SIZE << h->demote_order) / SZ_1K);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Nghia Le

The command "make clang-analyzer" detected a dead store.

Remove demote_size and corresponding assignment in function demote_size_show() to fix dead store, as demote_size is never read

I suggest adding punctuation (a ".") at the end of this sentence.

Otherwise, this patch looks good.

Send the next revised patch out to the recommendations from get_maintainers.pl and also CC: kernel-janitors <[email protected]> and me. Thanks.

Great work!

Lukas

Quoted 24 lines
---
 mm/hugetlb.c | 2 --
 1 file changed, 2 deletions(-)
mm/hugetlb.c +0 -3
index 993efa70bce4..ef00e6ad0f6a 100644
@@ -3706,11 +3706,9 @@ static ssize_t demote_size_show(struct kobject *kobj,
                                        struct kobj_attribute *attr, char *buf)
 {
        struct hstate *h;
-       unsigned long demote_size;
        int nid;
 
        h = kobj_to_hstate(kobj, &nid);
-       demote_size = h->demote_order;
 
        return sysfs_emit(buf, "%lukB\n",
                        (unsigned long)(PAGE_SIZE << h->demote_order) / SZ_1K);
--

2.25.1