public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Rudo <prudo@redhat.com>
To: lizhe <sensor1010@163.com>
Cc: bhe@redhat.com, vgoyal@redhat.com, dyoung@redhat.com,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel/crash_core.c : Remove redundant checks for ck_cmdline is NULL
Date: Tue, 3 May 2022 18:43:11 +0200	[thread overview]
Message-ID: <20220503184311.1d8c20a1@rotkaeppchen> (raw)
In-Reply-To: <6a0fa9cc.19d4.1808440ca50.Coremail.sensor1010@163.com>

Hi lizhe,

On Mon, 2 May 2022 18:11:20 +0800 (CST)
lizhe  <sensor1010@163.com> wrote:

> HI Philipp Rudo.
> 
> 
>       When ck_cmdline is NULL. The last three lines of this function are equivalent to : 
>           if ( !  NULL)
>                  return NULL;
>           return NULL;
>      This is obviously a redundant check.
> 
> 
>        I will use the above description to  describe the patch,

the explanation looks good to me.

Thanks!
Philipp


>  
>                                                                             thanks.
>                                                                             lizhe
>       
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> At 2022-04-26 16:39:52, "Philipp Rudo" <prudo@redhat.com> wrote:
> >Hi lizhe,
> >
> >On Mon, 25 Apr 2022 08:38:57 -0700
> >lizhe <sensor1010@163.com> wrote:
> >  
> >>  When ck_cmdline is NULL, the only caller of get_last_crashkernel()
> >>  has already done non-NULL check(see __parse_crashkernel()),
> >>  so it doesn't make any sense to make a check here  
> >
> >sorry, but I still don't like the description. What I don't understand
> >in particular is why you are mentioning the caller (__parse_crashkernel)
> >here. ck_cmdline is a local variable to get_last_crashkernel. So the
> >caller cannot perform any check on the variable but only the return
> >value of the function. So the patch description should describe why we
> >can remove the additional return NULL without changing the behavior of
> >the function.
> >
> >Thanks
> >Philipp
> >  
> >> Signed-off-by: lizhe <sensor1010@163.com>
> >> ---
> >>  kernel/crash_core.c | 3 ---
> >>  1 file changed, 3 deletions(-)
> >> 
> >> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> >> index 256cf6db573c..c232f01a2c54 100644
> >> --- a/kernel/crash_core.c
> >> +++ b/kernel/crash_core.c
> >> @@ -222,9 +222,6 @@ static __init char *get_last_crashkernel(char *cmdline,
> >>  		p = strstr(p+1, name);
> >>  	}
> >>  
> >> -	if (!ck_cmdline)
> >> -		return NULL;
> >> -
> >>  	return ck_cmdline;
> >>  }
> >>    


  parent reply	other threads:[~2022-05-03 16:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25 15:38 [PATCH] kernel/crash_core.c : Remove redundant checks for ck_cmdline is NULL lizhe
2022-04-26  8:39 ` Philipp Rudo
     [not found]   ` <6a0fa9cc.19d4.1808440ca50.Coremail.sensor1010@163.com>
2022-05-03 16:43     ` Philipp Rudo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-05-04 12:36 lizhe
2022-05-05 23:19 ` Baoquan He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220503184311.1d8c20a1@rotkaeppchen \
    --to=prudo@redhat.com \
    --cc=bhe@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sensor1010@163.com \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox