From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 11:05:05 +0200
A few update suggestions were taken into account from static source code analysis.
Markus Elfring (4): Combine two function calls into one in dma_buf_debug_show() Improve a size determination in dma_buf_attach() Adjust a null pointer check in dma_buf_attach() Use seq_putc() in two functions
drivers/dma-buf/dma-buf.c | 8 +++----- drivers/dma-buf/sync_debug.c | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-)
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 10:32:44 +0200
A bit of data was put into a sequence by two separate function calls. Print the same data by a single function call instead.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net --- drivers/dma-buf/dma-buf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 512bdbc23bbb..53257c166f4d 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -1122,9 +1122,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused) attach_count = 0;
list_for_each_entry(attach_obj, &buf_obj->attachments, node) { - seq_puts(s, "\t"); - - seq_printf(s, "%s\n", dev_name(attach_obj->dev)); + seq_printf(s, "\t%s\n", dev_name(attach_obj->dev)); attach_count++; }
2017-05-08 SF Markus Elfring elfring@users.sourceforge.net:
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 10:32:44 +0200
A bit of data was put into a sequence by two separate function calls. Print the same data by a single function call instead.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net
drivers/dma-buf/dma-buf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Reviewed-by: Gustavo Padovan gustavo.padovan@collabora.com
Gustavo
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 10:50:09 +0200
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net --- drivers/dma-buf/dma-buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 53257c166f4d..9887d72cf804 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -558,7 +558,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, if (WARN_ON(!dmabuf || !dev)) return ERR_PTR(-EINVAL);
- attach = kzalloc(sizeof(struct dma_buf_attachment), GFP_KERNEL); + attach = kzalloc(sizeof(*attach), GFP_KERNEL); if (attach == NULL) return ERR_PTR(-ENOMEM);
2017-05-08 SF Markus Elfring elfring@users.sourceforge.net:
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 10:50:09 +0200
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net
drivers/dma-buf/dma-buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Gustavo Padovan gustavo.padovan@collabora.com
Gustavo
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 10:54:17 +0200
The script "checkpatch.pl" pointed information out like the following.
Comparison to NULL could be written "!attach"
Thus adjust this expression.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net --- drivers/dma-buf/dma-buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 9887d72cf804..4a038dcf5361 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -559,7 +559,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, return ERR_PTR(-EINVAL);
attach = kzalloc(sizeof(*attach), GFP_KERNEL); - if (attach == NULL) + if (!attach) return ERR_PTR(-ENOMEM);
attach->dev = dev;
2017-05-08 SF Markus Elfring elfring@users.sourceforge.net:
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 10:54:17 +0200
The script "checkpatch.pl" pointed information out like the following.
Comparison to NULL could be written "!attach"
Thus adjust this expression.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net
drivers/dma-buf/dma-buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Gustavo Padovan gustavo.padovan@collabora.com
Gustavo
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 10:55:42 +0200
Three single characters (line breaks) should be put into a sequence. Thus use the corresponding function "seq_putc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net --- drivers/dma-buf/sync_debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c index c769dc653b34..a0d780ab68c3 100644 --- a/drivers/dma-buf/sync_debug.c +++ b/drivers/dma-buf/sync_debug.c @@ -110,7 +110,7 @@ static void sync_print_fence(struct seq_file *s, } }
- seq_puts(s, "\n"); + seq_putc(s, '\n'); }
static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj) @@ -161,7 +161,7 @@ static int sync_debugfs_show(struct seq_file *s, void *unused) sync_timeline_list);
sync_print_obj(s, obj); - seq_puts(s, "\n"); + seq_putc(s, '\n'); } spin_unlock_irqrestore(&sync_timeline_list_lock, flags);
@@ -173,7 +173,7 @@ static int sync_debugfs_show(struct seq_file *s, void *unused) container_of(pos, struct sync_file, sync_file_list);
sync_print_sync_file(s, sync_file); - seq_puts(s, "\n"); + seq_putc(s, '\n'); } spin_unlock_irqrestore(&sync_file_list_lock, flags); return 0;
Hi Markus,
Thank for your patches.
2017-05-08 SF Markus Elfring elfring@users.sourceforge.net:
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 10:55:42 +0200
Three single characters (line breaks) should be put into a sequence. Thus use the corresponding function "seq_putc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net
drivers/dma-buf/sync_debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Gustavo Padovan gustavo.padovan@collabora.com
Gustavo
Hi Markus,
On May 8, 2017 14:40, "SF Markus Elfring" elfring@users.sourceforge.net wrote:
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 11:05:05 +0200
A few update suggestions were taken into account from static source code analysis.
Thanks much for your patches; will where them up now.
Markus Elfring (4): Combine two function calls into one in dma_buf_debug_show() Improve a size determination in dma_buf_attach() Adjust a null pointer check in dma_buf_attach() Use seq_putc() in two functions
drivers/dma-buf/dma-buf.c | 8 +++----- drivers/dma-buf/sync_debug.c | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-)
Best, Sumit.
-- 2.12.2
Hello Markus,
On 8 May 2017 at 14:40, SF Markus Elfring elfring@users.sourceforge.net wrote:
From: Markus Elfring elfring@users.sourceforge.net Date: Mon, 8 May 2017 11:05:05 +0200
A few update suggestions were taken into account from static source code analysis.
Markus Elfring (4): Combine two function calls into one in dma_buf_debug_show() Improve a size determination in dma_buf_attach() Adjust a null pointer check in dma_buf_attach() Use seq_putc() in two functions
All queued up in drm-misc-next now. Thanks!
drivers/dma-buf/dma-buf.c | 8 +++----- drivers/dma-buf/sync_debug.c | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-)
-- 2.12.2
Best regards, Sumit.
linaro-mm-sig@lists.linaro.org