[PATCH v2] proc/fd: Remove unnecessary {files, f_flags, file} initialization in seq_show()

2020-06-12 Thread Kaitao Cheng
'files' will be immediately reassigned. 'f_flags' and 'file' will be overwritten in the if{} or seq_show() directly exits with an error. so we don't need to consume CPU resources to initialize them. Signed-off-by: Kaitao Cheng --- v2 ChangeLog: 1.

[PATCH v2] trace/ftrace: fix maybe-uninitialized compiler warning

2020-05-29 Thread Kaitao Cheng
During build compiler reports some 'false positive' warnings about variables {'seq_ops', 'filtered_pids', 'other_pids'} may be used uninitialized. This patch silences these warnings. Also delete some useless spaces Signed-off-by: Kaitao Cheng --- kernel/

[PATCH v2] blkdev: Replace blksize_bits() with ilog2()

2020-05-29 Thread Kaitao Cheng
There is a function named ilog2() exist which can replace blksize. The generated code will be shorter and more efficient on some architecture, such as arm64. And ilog2() can be optimized according to different architecture. Signed-off-by: Kaitao Cheng --- changes in v2: Remove all

[PATCH] proc/base: Skip assignment to len when there is no error on d_path in do_proc_readlink.

2020-05-27 Thread Kaitao Cheng
we don't need {len = PTR_ERR(pathname)} when IS_ERR(pathname) is false, it's better to move it into if(IS_ERR(pathname)){}. Signed-off-by: Kaitao Cheng --- fs/proc/base.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index d8

[PATCH] trace/ftrace: fix maybe-uninitialized compiler warning

2020-05-23 Thread Kaitao Cheng
During build compiler reports some 'false positive' warnings about variables {'seq_ops', 'filtered_pids', 'other_pids'} may be used uninitialized. This patch silences these warnings. Also delete some useless spaces Signed-off-by: Kaitao Cheng --- kerne

[PATCH] linux/blkdev.h: Use ilog2() directly in blksize_bits()

2020-05-23 Thread Kaitao Cheng
blksize_bits() can be achieved through ilog2(), and ilog2() is more efficient. Signed-off-by: Kaitao Cheng --- include/linux/blkdev.h | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2b33166b9daf..cce96abac4d4 100644

[PATCH] proc/fd: Remove the initialization of variables in seq_show()

2020-05-23 Thread Kaitao Cheng
The variables{files, file} will definitely be assigned, so we don't need to initialize them. Signed-off-by: Kaitao Cheng --- fs/proc/fd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/proc/fd.c b/fs/proc/fd.c index 81882a13212d..6f95baf44e37 100644 --- a/fs

[PATCH] mm, page_alloc: drop pointless static qualifier in build_zonelists()

2019-09-27 Thread Kaitao Cheng
There is no need to make the 'node_order' variable static since new value always be assigned before use it. Signed-off-by: Kaitao Cheng Signed-off-by: Muchun Song --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_all

[PATCH RESEND v2] driver core: Replace simple_strto{l,ul} by kstrtou{l,ul}

2018-11-28 Thread Kaitao Cheng
From: Kaitao cheng The simple_strto{l,ul} are deprecated, use kstrtou{l,ul} instead. Signed-off-by: Kaitao cheng --- drivers/base/core.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 04bbcd7..ed145fb

[PATCH] driver core: Replace simple_strto{l,ul} by kstrtou{l,ul}

2018-11-06 Thread Kaitao Cheng
From: Kaitao cheng The simple_strto{l,ul} are deprecated, use kstrtou{l,ul} instead. Signed-off-by: Kaitao cheng --- drivers/base/core.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 04bbcd7..ed145fb