linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: media: zoran: fix warnings reported by checkpatch
@ 2022-04-18 11:59 Aliya Rahmani
  2022-04-18 11:59 ` [PATCH 1/3] staging: media: zoran: use seq_puts() instead of seq_printf() Aliya Rahmani
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Aliya Rahmani @ 2022-04-18 11:59 UTC (permalink / raw)
  To: clabbe; +Cc: gregkh, linux-staging, outreachy, linux-kernel, Aliya Rahmani

These patches address style issues found by checkpatch in the
zoran/videocodec.c file.

Aliya Rahmani (3):
 staging: media: zoran: use seq_puts() instead of seq_printf()
 staging: media: zoran: else is not generally useful after a break or return
 staging: media: zoran: avoid macro argument precedence issues

drivers/staging/media/zoran/videocodec.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

-- 
2.25.1


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

* [PATCH 1/3] staging: media: zoran: use seq_puts() instead of seq_printf()
  2022-04-18 11:59 [PATCH 0/3] staging: media: zoran: fix warnings reported by checkpatch Aliya Rahmani
@ 2022-04-18 11:59 ` Aliya Rahmani
  2022-04-18 11:59 ` [PATCH 2/3] staging: media: zoran: Code cleanup - else is not generally useful after a break or return Aliya Rahmani
  2022-04-18 11:59 ` [PATCH 3/3] staging: media: zoran: avoid macro argument precedence issues Aliya Rahmani
  2 siblings, 0 replies; 6+ messages in thread
From: Aliya Rahmani @ 2022-04-18 11:59 UTC (permalink / raw)
  To: clabbe; +Cc: gregkh, linux-staging, outreachy, linux-kernel, Aliya Rahmani

Replace seq_printf() with seq_puts() for a constant format without
additional arguments, reported by checkpatch.

Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com>
---
 drivers/staging/media/zoran/videocodec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c
index 3af7d02bd910..16a1f23a7f19 100644
--- a/drivers/staging/media/zoran/videocodec.c
+++ b/drivers/staging/media/zoran/videocodec.c
@@ -250,8 +250,8 @@ int videocodec_debugfs_show(struct seq_file *m)
 	struct codec_list *h = codeclist_top;
 	struct attached_list *a;
 
-	seq_printf(m, "<S>lave or attached <M>aster name  type flags    magic    ");
-	seq_printf(m, "(connected as)\n");
+	seq_puts(m, "<S>lave or attached <M>aster name  type flags    magic    ");
+	seq_puts(m, "(connected as)\n");

-- 
2.25.1


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

* [PATCH 2/3] staging: media: zoran: Code cleanup - else is not generally useful after a break or return
  2022-04-18 11:59 [PATCH 0/3] staging: media: zoran: fix warnings reported by checkpatch Aliya Rahmani
  2022-04-18 11:59 ` [PATCH 1/3] staging: media: zoran: use seq_puts() instead of seq_printf() Aliya Rahmani
@ 2022-04-18 11:59 ` Aliya Rahmani
  2022-04-18 12:11   ` Julia Lawall
  2022-04-18 11:59 ` [PATCH 3/3] staging: media: zoran: avoid macro argument precedence issues Aliya Rahmani
  2 siblings, 1 reply; 6+ messages in thread
From: Aliya Rahmani @ 2022-04-18 11:59 UTC (permalink / raw)
  To: clabbe; +Cc: gregkh, linux-staging, outreachy, linux-kernel, Aliya Rahmani

Remove the else without affecting the logic. Fixes the checkpatch warning: else is not generally useful after a break or return

Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com>
---
 drivers/staging/media/zoran/videocodec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c
index 16a1f23a7f19..19732a47c8bd 100644
--- a/drivers/staging/media/zoran/videocodec.c
+++ b/drivers/staging/media/zoran/videocodec.c
@@ -98,9 +98,8 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
 
 				h->attached += 1;
 				return codec;
-			} else {
-				kfree(codec);
 			}
+			kfree(codec);
 		}
 		h = h->next;
 	}
-- 
2.25.1


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

* [PATCH 3/3] staging: media: zoran: avoid macro argument precedence issues
  2022-04-18 11:59 [PATCH 0/3] staging: media: zoran: fix warnings reported by checkpatch Aliya Rahmani
  2022-04-18 11:59 ` [PATCH 1/3] staging: media: zoran: use seq_puts() instead of seq_printf() Aliya Rahmani
  2022-04-18 11:59 ` [PATCH 2/3] staging: media: zoran: Code cleanup - else is not generally useful after a break or return Aliya Rahmani
@ 2022-04-18 11:59 ` Aliya Rahmani
  2022-04-18 12:09   ` Julia Lawall
  2 siblings, 1 reply; 6+ messages in thread
From: Aliya Rahmani @ 2022-04-18 11:59 UTC (permalink / raw)
  To: clabbe; +Cc: gregkh, linux-staging, outreachy, linux-kernel, Aliya Rahmani

This patch fixes checkpatch warnings of precedence issues. Added parentheses
around macro argument 'num'.

Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com>
---
 drivers/staging/media/zoran/videocodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c
index 19732a47c8bd..925f90fd5885 100644
--- a/drivers/staging/media/zoran/videocodec.c
+++ b/drivers/staging/media/zoran/videocodec.c
@@ -22,7 +22,7 @@ MODULE_PARM_DESC(videocodec_debug, "Debug level (0-4)");
 
 #define dprintk(num, format, args...) \
 	do { \
-		if (videocodec_debug >= num) \
+		if (videocodec_debug >= (num)) \
 			printk(format, ##args); \
 	} while (0)
 
-- 
2.25.1


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

* Re: [PATCH 3/3] staging: media: zoran: avoid macro argument precedence issues
  2022-04-18 11:59 ` [PATCH 3/3] staging: media: zoran: avoid macro argument precedence issues Aliya Rahmani
@ 2022-04-18 12:09   ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2022-04-18 12:09 UTC (permalink / raw)
  To: Aliya Rahmani; +Cc: clabbe, gregkh, linux-staging, outreachy, linux-kernel



On Mon, 18 Apr 2022, Aliya Rahmani wrote:

> This patch fixes checkpatch warnings of precedence issues. Added parentheses
> around macro argument 'num'.

You should use the imperative.  This "Add" rather than "Added".

The subject line would be better as "add parentheses on macro parameter".
That describes what you did, rather than what you avoided (avoided how?).

julia

>
> Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com>
> ---
>  drivers/staging/media/zoran/videocodec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c
> index 19732a47c8bd..925f90fd5885 100644
> --- a/drivers/staging/media/zoran/videocodec.c
> +++ b/drivers/staging/media/zoran/videocodec.c
> @@ -22,7 +22,7 @@ MODULE_PARM_DESC(videocodec_debug, "Debug level (0-4)");
>
>  #define dprintk(num, format, args...) \
>  	do { \
> -		if (videocodec_debug >= num) \
> +		if (videocodec_debug >= (num)) \
>  			printk(format, ##args); \
>  	} while (0)
>
> --
> 2.25.1
>
>
>

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

* Re: [PATCH 2/3] staging: media: zoran: Code cleanup - else is not generally useful after a break or return
  2022-04-18 11:59 ` [PATCH 2/3] staging: media: zoran: Code cleanup - else is not generally useful after a break or return Aliya Rahmani
@ 2022-04-18 12:11   ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2022-04-18 12:11 UTC (permalink / raw)
  To: Aliya Rahmani; +Cc: clabbe, gregkh, linux-staging, outreachy, linux-kernel

Just say concisely what you did in the subject line.  For example, "remove
unneeded else".  The reader can wait to see the message to find out the
details.  "Code cleanup" takes up a lot of space, and doesn't give much
information.

On Mon, 18 Apr 2022, Aliya Rahmani wrote:

> Remove the else without affecting the logic. Fixes the checkpatch warning: else is not generally useful after a break or return

Commit log messages should be limited to around 70 characters per line.

julia

> Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com>
> ---
>  drivers/staging/media/zoran/videocodec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c
> index 16a1f23a7f19..19732a47c8bd 100644
> --- a/drivers/staging/media/zoran/videocodec.c
> +++ b/drivers/staging/media/zoran/videocodec.c
> @@ -98,9 +98,8 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
>
>  				h->attached += 1;
>  				return codec;
> -			} else {
> -				kfree(codec);
>  			}
> +			kfree(codec);
>  		}
>  		h = h->next;
>  	}
> --
> 2.25.1
>
>
>

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

end of thread, other threads:[~2022-04-18 12:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 11:59 [PATCH 0/3] staging: media: zoran: fix warnings reported by checkpatch Aliya Rahmani
2022-04-18 11:59 ` [PATCH 1/3] staging: media: zoran: use seq_puts() instead of seq_printf() Aliya Rahmani
2022-04-18 11:59 ` [PATCH 2/3] staging: media: zoran: Code cleanup - else is not generally useful after a break or return Aliya Rahmani
2022-04-18 12:11   ` Julia Lawall
2022-04-18 11:59 ` [PATCH 3/3] staging: media: zoran: avoid macro argument precedence issues Aliya Rahmani
2022-04-18 12:09   ` Julia Lawall

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).