* [PATCH linux-next v2] mm/slub: Remove the unneeded result variable
@ 2022-08-22 1:38 cgel.zte
2022-08-23 14:08 ` Vlastimil Babka
0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-08-22 1:38 UTC (permalink / raw)
To: 42.hyeyoo
Cc: cl, penberg, rientjes, iamjoonsoo.kim, akpm, vbabka,
roman.gushchin, linux-mm, linux-kernel, ye xingchen, Zeal Robot
From: ye xingchen <ye.xingchen@zte.com.cn>
Return the value from attribute->store(s, buf, len) and
attribute->show(s, buf) directly instead of storing it in
another redundant variable.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
v1 -> v2
Add the whitespace between subsystem and summary in subject line.
mm/slub.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 6953c3367bc2..7bea010a20ff 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5852,7 +5852,6 @@ static ssize_t slab_attr_show(struct kobject *kobj,
{
struct slab_attribute *attribute;
struct kmem_cache *s;
- int err;
attribute = to_slab_attr(attr);
s = to_slab(kobj);
@@ -5860,9 +5859,7 @@ static ssize_t slab_attr_show(struct kobject *kobj,
if (!attribute->show)
return -EIO;
- err = attribute->show(s, buf);
-
- return err;
+ return attribute->show(s, buf);
}
static ssize_t slab_attr_store(struct kobject *kobj,
@@ -5871,7 +5868,6 @@ static ssize_t slab_attr_store(struct kobject *kobj,
{
struct slab_attribute *attribute;
struct kmem_cache *s;
- int err;
attribute = to_slab_attr(attr);
s = to_slab(kobj);
@@ -5879,8 +5875,7 @@ static ssize_t slab_attr_store(struct kobject *kobj,
if (!attribute->store)
return -EIO;
- err = attribute->store(s, buf, len);
- return err;
+ return attribute->store(s, buf, len);
}
static void kmem_cache_release(struct kobject *k)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH linux-next v2] mm/slub: Remove the unneeded result variable
2022-08-22 1:38 [PATCH linux-next v2] mm/slub: Remove the unneeded result variable cgel.zte
@ 2022-08-23 14:08 ` Vlastimil Babka
0 siblings, 0 replies; 2+ messages in thread
From: Vlastimil Babka @ 2022-08-23 14:08 UTC (permalink / raw)
To: cgel.zte, 42.hyeyoo
Cc: cl, penberg, rientjes, iamjoonsoo.kim, akpm, roman.gushchin,
linux-mm, linux-kernel, ye xingchen, Zeal Robot
On 8/22/22 03:38, cgel.zte@gmail.com wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> Return the value from attribute->store(s, buf, len) and
> attribute->show(s, buf) directly instead of storing it in
> another redundant variable.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Thanks, added to slab.git for-6.1/trivial
> ---
> v1 -> v2
> Add the whitespace between subsystem and summary in subject line.
> mm/slub.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 6953c3367bc2..7bea010a20ff 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -5852,7 +5852,6 @@ static ssize_t slab_attr_show(struct kobject *kobj,
> {
> struct slab_attribute *attribute;
> struct kmem_cache *s;
> - int err;
>
> attribute = to_slab_attr(attr);
> s = to_slab(kobj);
> @@ -5860,9 +5859,7 @@ static ssize_t slab_attr_show(struct kobject *kobj,
> if (!attribute->show)
> return -EIO;
>
> - err = attribute->show(s, buf);
> -
> - return err;
> + return attribute->show(s, buf);
> }
>
> static ssize_t slab_attr_store(struct kobject *kobj,
> @@ -5871,7 +5868,6 @@ static ssize_t slab_attr_store(struct kobject *kobj,
> {
> struct slab_attribute *attribute;
> struct kmem_cache *s;
> - int err;
>
> attribute = to_slab_attr(attr);
> s = to_slab(kobj);
> @@ -5879,8 +5875,7 @@ static ssize_t slab_attr_store(struct kobject *kobj,
> if (!attribute->store)
> return -EIO;
>
> - err = attribute->store(s, buf, len);
> - return err;
> + return attribute->store(s, buf, len);
> }
>
> static void kmem_cache_release(struct kobject *k)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-23 17:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-22 1:38 [PATCH linux-next v2] mm/slub: Remove the unneeded result variable cgel.zte
2022-08-23 14:08 ` Vlastimil Babka
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).