From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8629301960296870972==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] printk: fix returnvar.cocci warnings Date: Sun, 01 Nov 2020 21:05:06 +0800 Message-ID: <20201101130506.GA6756@4f72a4574d93> In-Reply-To: <202011012100.rzwEcHrE-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============8629301960296870972== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org TO: John Ogness CC: Sebastian Andrzej Siewior From: kernel test robot kernel/printk/printk.c:2808:5-8: Unneeded variable: "ret". Return "- ENOMEM= " on line 2819 Remove unneeded variable used to store return value. Generated by: scripts/coccinelle/misc/returnvar.cocci Fixes: ca4fcaa60de9 ("printk: move console printing to kthreads") CC: John Ogness Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.g= it linux-5.10.y-rt-rebase head: 87b7b3d2cb296950a0e3005406899ccfbbc9da7c commit: ca4fcaa60de914c0ef6864983a8488bf5ab6cafb [57/209] printk: move cons= ole printing to kthreads :::::: branch date: 2 days ago :::::: commit date: 2 days ago Please take the patch only if it's a positive warning. Thanks! printk.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2805,7 +2805,6 @@ static int printk_kthread_func(void *dat char *ext_text =3D NULL; size_t dropped_len; char *dropped_text; - int ret =3D -ENOMEM; char *write_text; u64 printk_seq; size_t len; @@ -2816,7 +2815,7 @@ static int printk_kthread_func(void *dat if (con->flags & CON_EXTENDED) { ext_text =3D kmalloc(CONSOLE_EXT_LOG_MAX, GFP_KERNEL); if (!ext_text) - return ret; + return -ENOMEM; } text =3D kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL); dropped_text =3D kmalloc(64, GFP_KERNEL); @@ -2904,7 +2903,7 @@ out: pr_info("%sconsole [%s%d]: printing thread stopped\n", (con->flags & CON_BOOT) ? "boot" : "" , con->name, con->index); - return ret; + return -ENOMEM; } = static void start_printk_kthread(struct console *con) --===============8629301960296870972==--