All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: sm750fb: Replace comparisons with NULL and 0
@ 2024-03-19 18:17 Chandra Pratap
  2024-03-20  5:08 ` Dan Carpenter
  0 siblings, 1 reply; 9+ messages in thread
From: Chandra Pratap @ 2024-03-19 18:17 UTC (permalink / raw)
  To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
	linux-kernel, outreachy
  Cc: Chandra Pratap

Replace '(foo != NULL)' with '(foo)' and 'x != 0'
with 'x' to adhere to the coding standards.

Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 04c1b32a22c5..4537f007a810 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -926,7 +926,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
 		goto NO_PARAM;
 	}
 
-	while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
+	while ((opt = strsep(&src, ":")) && *opt) {
 		dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
 		dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
 
@@ -1147,7 +1147,7 @@ static int __init lynxfb_setup(char *options)
 	 * strsep() updates @options to pointer after the first found token
 	 * it also returns the pointer ahead the token.
 	 */
-	while ((opt = strsep(&options, ":")) != NULL) {
+	while ((opt = strsep(&options, ":"))) {
 		/* options that mean for any lynx chips are configured here */
 		if (!strncmp(opt, "noaccel", strlen("noaccel"))) {
 			g_noaccel = 1;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] staging: sm750fb: Replace comparisons with NULL and 0
  2024-03-19 18:17 [PATCH] staging: sm750fb: Replace comparisons with NULL and 0 Chandra Pratap
@ 2024-03-20  5:08 ` Dan Carpenter
  2024-03-20 18:09   ` [PATCH v2] " Chandra Pratap
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2024-03-20  5:08 UTC (permalink / raw)
  To: Chandra Pratap
  Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
	linux-kernel, outreachy

On Tue, Mar 19, 2024 at 11:47:35PM +0530, Chandra Pratap wrote:
> Replace '(foo != NULL)' with '(foo)' and 'x != 0'
> with 'x' to adhere to the coding standards.
> 

In your commit message use "opt" and "*opt" instead of "foo" and "x".

Removing the != NULL is fine, but the *opt != 0 should be changed to
(*opt != '\0').  There are times where comparing against zero helps
readability.  I wrote a blog about this, but I had forgotten the case
with the NUL terminator...

https://staticthinking.wordpress.com/2024/02/20/when-to-use-0/

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] staging: sm750fb: Replace comparisons with NULL and 0
  2024-03-20  5:08 ` Dan Carpenter
@ 2024-03-20 18:09   ` Chandra Pratap
  2024-03-21  5:41     ` Dan Carpenter
  2024-03-22  9:49     ` Greg KH
  0 siblings, 2 replies; 9+ messages in thread
From: Chandra Pratap @ 2024-03-20 18:09 UTC (permalink / raw)
  Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
	linux-kernel, outreachy, Chandra Pratap

Replace '(opt != NULL)' with '(opt)' and '(*opt != 0)'
with '(*opt != '\0')' to adhere to the coding standards.

Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
---
Changes in v2:
  - Update the commit message to reflect the changes better
  - replace (*opt) with (*opt != '\0')

 drivers/staging/sm750fb/sm750.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 04c1b32a22c5..0391235c5666 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -926,7 +926,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
 		goto NO_PARAM;
 	}
 
-	while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
+	while ((opt = strsep(&src, ":"))  && *opt != '\0') {
 		dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
 		dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
 
@@ -1147,7 +1147,7 @@ static int __init lynxfb_setup(char *options)
 	 * strsep() updates @options to pointer after the first found token
 	 * it also returns the pointer ahead the token.
 	 */
-	while ((opt = strsep(&options, ":")) != NULL) {
+	while ((opt = strsep(&options, ":"))) {
 		/* options that mean for any lynx chips are configured here */
 		if (!strncmp(opt, "noaccel", strlen("noaccel"))) {
 			g_noaccel = 1;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] staging: sm750fb: Replace comparisons with NULL and 0
  2024-03-20 18:09   ` [PATCH v2] " Chandra Pratap
@ 2024-03-21  5:41     ` Dan Carpenter
  2024-03-22  9:49     ` Greg KH
  1 sibling, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2024-03-21  5:41 UTC (permalink / raw)
  To: Chandra Pratap
  Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
	linux-kernel, outreachy

On Wed, Mar 20, 2024 at 11:39:43PM +0530, Chandra Pratap wrote:
> Replace '(opt != NULL)' with '(opt)' and '(*opt != 0)'
> with '(*opt != '\0')' to adhere to the coding standards.
> 
> Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
> ---
> Changes in v2:
>   - Update the commit message to reflect the changes better
>   - replace (*opt) with (*opt != '\0')
> 

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] staging: sm750fb: Replace comparisons with NULL and 0
  2024-03-20 18:09   ` [PATCH v2] " Chandra Pratap
  2024-03-21  5:41     ` Dan Carpenter
@ 2024-03-22  9:49     ` Greg KH
  2024-03-22 14:10       ` [PATCH v3] " Chandra Pratap
  2024-03-22 15:16       ` Chandra Pratap
  1 sibling, 2 replies; 9+ messages in thread
From: Greg KH @ 2024-03-22  9:49 UTC (permalink / raw)
  To: Chandra Pratap
  Cc: sudipm.mukherjee, teddy.wang, linux-fbdev, linux-staging,
	linux-kernel, outreachy

On Wed, Mar 20, 2024 at 11:39:43PM +0530, Chandra Pratap wrote:
> Replace '(opt != NULL)' with '(opt)' and '(*opt != 0)'
> with '(*opt != '\0')' to adhere to the coding standards.
> 
> Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
> ---
> Changes in v2:
>   - Update the commit message to reflect the changes better
>   - replace (*opt) with (*opt != '\0')
> 
>  drivers/staging/sm750fb/sm750.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index 04c1b32a22c5..0391235c5666 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -926,7 +926,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
>  		goto NO_PARAM;
>  	}
>  
> -	while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
> +	while ((opt = strsep(&src, ":"))  && *opt != '\0') {

Why 2 spaces?  Please fix in a new version.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3] staging: sm750fb: Replace comparisons with NULL and 0
  2024-03-22  9:49     ` Greg KH
@ 2024-03-22 14:10       ` Chandra Pratap
  2024-03-22 14:25         ` Greg KH
  2024-03-22 15:16       ` Chandra Pratap
  1 sibling, 1 reply; 9+ messages in thread
From: Chandra Pratap @ 2024-03-22 14:10 UTC (permalink / raw)
  Cc: sudipm.mukherjee, dan.carpenter, teddy.wang, gregkh, linux-fbdev,
	linux-staging, linux-kernel, outreachy, Chandra Pratap

Replace '(opt != NULL)' with '(opt)' and '(*opt != 0)'
with '(*opt != '\0')' to adhere to the coding standards.

Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 04c1b32a22c5..c4b944f82fb9 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -926,7 +926,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
 		goto NO_PARAM;
 	}
 
-	while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
+	while ((opt = strsep(&src, ":")) && *opt != '\0') {
 		dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
 		dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
 
@@ -1147,7 +1147,7 @@ static int __init lynxfb_setup(char *options)
 	 * strsep() updates @options to pointer after the first found token
 	 * it also returns the pointer ahead the token.
 	 */
-	while ((opt = strsep(&options, ":")) != NULL) {
+	while ((opt = strsep(&options, ":"))) {
 		/* options that mean for any lynx chips are configured here */
 		if (!strncmp(opt, "noaccel", strlen("noaccel"))) {
 			g_noaccel = 1;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3] staging: sm750fb: Replace comparisons with NULL and 0
  2024-03-22 14:10       ` [PATCH v3] " Chandra Pratap
@ 2024-03-22 14:25         ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2024-03-22 14:25 UTC (permalink / raw)
  To: Chandra Pratap
  Cc: sudipm.mukherjee, dan.carpenter, teddy.wang, linux-fbdev,
	linux-staging, linux-kernel, outreachy

On Fri, Mar 22, 2024 at 07:40:31PM +0530, Chandra Pratap wrote:
> Replace '(opt != NULL)' with '(opt)' and '(*opt != 0)'
> with '(*opt != '\0')' to adhere to the coding standards.
> 
> Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
> ---
>  drivers/staging/sm750fb/sm750.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index 04c1b32a22c5..c4b944f82fb9 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -926,7 +926,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
>  		goto NO_PARAM;
>  	}
>  
> -	while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
> +	while ((opt = strsep(&src, ":")) && *opt != '\0') {
>  		dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
>  		dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
>  
> @@ -1147,7 +1147,7 @@ static int __init lynxfb_setup(char *options)
>  	 * strsep() updates @options to pointer after the first found token
>  	 * it also returns the pointer ahead the token.
>  	 */
> -	while ((opt = strsep(&options, ":")) != NULL) {
> +	while ((opt = strsep(&options, ":"))) {
>  		/* options that mean for any lynx chips are configured here */
>  		if (!strncmp(opt, "noaccel", strlen("noaccel"))) {
>  			g_noaccel = 1;
> -- 
> 2.34.1
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/process/submitting-patches.rst for what
  needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3] staging: sm750fb: Replace comparisons with NULL and 0
  2024-03-22  9:49     ` Greg KH
  2024-03-22 14:10       ` [PATCH v3] " Chandra Pratap
@ 2024-03-22 15:16       ` Chandra Pratap
  2024-03-23  2:59         ` Alison Schofield
  1 sibling, 1 reply; 9+ messages in thread
From: Chandra Pratap @ 2024-03-22 15:16 UTC (permalink / raw)
  Cc: sudipm.mukherjee, dan.carpenter, teddy.wang, gregkh, linux-fbdev,
	linux-staging, linux-kernel, outreachy, Chandra Pratap

Replace '(opt != NULL)' with '(opt)' and '(*opt != 0)'
with '(*opt != '\0')' to adhere to the coding standards.

Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
---

Please ignore the other v3 patch I sent, I forgot to write
the change log in that patch. Apologies for any incovenienece
caused.

Changes in v2:
  - Update the commit message to reflect the changes better
  - Replace (*opt) with (*opt != '\0')

Changes in v3:
  - Remove unncessary spacing

 drivers/staging/sm750fb/sm750.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 04c1b32a22c5..c4b944f82fb9 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -926,7 +926,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
 		goto NO_PARAM;
 	}
 
-	while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
+	while ((opt = strsep(&src, ":")) && *opt != '\0') {
 		dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
 		dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
 
@@ -1147,7 +1147,7 @@ static int __init lynxfb_setup(char *options)
 	 * strsep() updates @options to pointer after the first found token
 	 * it also returns the pointer ahead the token.
 	 */
-	while ((opt = strsep(&options, ":")) != NULL) {
+	while ((opt = strsep(&options, ":"))) {
 		/* options that mean for any lynx chips are configured here */
 		if (!strncmp(opt, "noaccel", strlen("noaccel"))) {
 			g_noaccel = 1;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3] staging: sm750fb: Replace comparisons with NULL and 0
  2024-03-22 15:16       ` Chandra Pratap
@ 2024-03-23  2:59         ` Alison Schofield
  0 siblings, 0 replies; 9+ messages in thread
From: Alison Schofield @ 2024-03-23  2:59 UTC (permalink / raw)
  To: Chandra Pratap
  Cc: sudipm.mukherjee, dan.carpenter, teddy.wang, gregkh, linux-fbdev,
	linux-staging, linux-kernel, outreachy

On Fri, Mar 22, 2024 at 08:46:33PM +0530, Chandra Pratap wrote:
> Replace '(opt != NULL)' with '(opt)' and '(*opt != 0)'
> with '(*opt != '\0')' to adhere to the coding standards.
> 
> Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
> ---
> 
> Please ignore the other v3 patch I sent, I forgot to write
> the change log in that patch. Apologies for any incovenienece
> caused.

Hi Chandra,

No need to apologize, but you do need to send a v4. Any change
in the patch is a new rev - even if that change is to the
changelog. Maintainers are using automated tooling to grab
the latest revisions and two patches with the same version 
number will be disregarded. 

Please send a v4 with:

Changes in v4:
  - Include the changelog.

While you're at it, reverse the order of this changelog.
Put most recent revisions first - ie 4,3,2 order.

Also, post the patch as a new message, not a reply to prior
patches.

Thanks,
Alison


> 
> Changes in v2:
>   - Update the commit message to reflect the changes better
>   - Replace (*opt) with (*opt != '\0')
> 
> Changes in v3:
>   - Remove unncessary spacing
> 
>  drivers/staging/sm750fb/sm750.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index 04c1b32a22c5..c4b944f82fb9 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -926,7 +926,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
>  		goto NO_PARAM;
>  	}
>  
> -	while ((opt = strsep(&src, ":")) != NULL && *opt != 0) {
> +	while ((opt = strsep(&src, ":")) && *opt != '\0') {
>  		dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
>  		dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
>  
> @@ -1147,7 +1147,7 @@ static int __init lynxfb_setup(char *options)
>  	 * strsep() updates @options to pointer after the first found token
>  	 * it also returns the pointer ahead the token.
>  	 */
> -	while ((opt = strsep(&options, ":")) != NULL) {
> +	while ((opt = strsep(&options, ":"))) {
>  		/* options that mean for any lynx chips are configured here */
>  		if (!strncmp(opt, "noaccel", strlen("noaccel"))) {
>  			g_noaccel = 1;
> -- 
> 2.34.1
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-03-23  2:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-19 18:17 [PATCH] staging: sm750fb: Replace comparisons with NULL and 0 Chandra Pratap
2024-03-20  5:08 ` Dan Carpenter
2024-03-20 18:09   ` [PATCH v2] " Chandra Pratap
2024-03-21  5:41     ` Dan Carpenter
2024-03-22  9:49     ` Greg KH
2024-03-22 14:10       ` [PATCH v3] " Chandra Pratap
2024-03-22 14:25         ` Greg KH
2024-03-22 15:16       ` Chandra Pratap
2024-03-23  2:59         ` Alison Schofield

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.