2022-04-19 05:44:57

by Aliya Rahmani

[permalink] [raw]
Subject: [PATCH v3 0/3] staging: media: zoran: fix warnings reported by checkpatch

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

changes since v2:
PATCH[2/3] : Rework commit description and subject
PATCH[3/3] : Rework commit description and subject

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


2022-04-19 19:14:04

by Aliya Rahmani

[permalink] [raw]
Subject: [PATCH v3 2/3] staging: media: zoran: else is not generally useful after a break or return

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

Signed-off-by: Aliya Rahmani <[email protected]>
---
changes since v2: Rework commit description and subject
---

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

2022-04-20 16:50:33

by Aliya Rahmani

[permalink] [raw]
Subject: [PATCH v3 1/3] staging: media: zoran: use seq_puts() instead of seq_printf()

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

Signed-off-by: Aliya Rahmani <[email protected]>
---
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

2022-04-22 15:16:50

by Corentin LABBE

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] staging: media: zoran: fix warnings reported by checkpatch

Le Mon, Apr 18, 2022 at 10:44:50PM +0530, Aliya Rahmani a ?crit :
> These patches address style issues found by checkpatch in the
> zoran/videocodec.c file.
>
> changes since v2:
> PATCH[2/3] : Rework commit description and subject
> PATCH[3/3] : Rework commit description and subject
>
> 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(-)
>

Thanks for your patchs

Only problem is that your patch 1 did not apply, but this was easily fixed for applying.

The whole serie is:
Tested-by: Corentin Labbe <[email protected]>
Acked-by: Corentin Labbe <[email protected]>

Regards

2022-04-22 15:29:35

by Aliya Rahmani

[permalink] [raw]
Subject: [PATCH v3 3/3] staging: media: zoran: add parentheses on macro parameter

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

Signed-off-by: Aliya Rahmani <[email protected]>
---
changes since v2: Rework commit description and subject
---
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