* [PATCH 0/3] [media] Freescale VIU: Adjustments for five function implementations
@ 2017-09-08 19:40 SF Markus Elfring
2017-09-08 19:42 ` [PATCH 1/3] [media] fsl-viu: Delete an error message for a failed memory allocation in viu_of_probe() SF Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-08 19:40 UTC (permalink / raw)
To: linux-media, Arvind Yadav, Bhumika Goyal, Geliang Tang,
Hans Verkuil, Mauro Carvalho Chehab, Prabhakar Lad
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 8 Sep 2017 21:28:12 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Delete an error message for a failed memory allocation in viu_of_probe()
Improve two size determinations in viu_of_probe()
Adjust six checks for null pointers
drivers/media/platform/fsl-viu.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
--
2.14.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] [media] fsl-viu: Delete an error message for a failed memory allocation in viu_of_probe()
2017-09-08 19:40 [PATCH 0/3] [media] Freescale VIU: Adjustments for five function implementations SF Markus Elfring
@ 2017-09-08 19:42 ` SF Markus Elfring
2017-09-08 19:44 ` [PATCH 2/3] [media] fsl-viu: Improve two size determinations " SF Markus Elfring
2017-09-08 19:46 ` [PATCH 3/3] [media] fsl-viu: Adjust six checks for null pointers SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-08 19:42 UTC (permalink / raw)
To: linux-media, Arvind Yadav, Bhumika Goyal, Geliang Tang,
Hans Verkuil, Mauro Carvalho Chehab, Prabhakar Lad
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 8 Sep 2017 21:03:22 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/platform/fsl-viu.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index fb43025df573..526f80649864 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -1433,5 +1433,4 @@ static int viu_of_probe(struct platform_device *op)
if (!viu_dev) {
- dev_err(&op->dev, "Can't allocate private structure\n");
ret = -ENOMEM;
goto err;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] [media] fsl-viu: Improve two size determinations in viu_of_probe()
2017-09-08 19:40 [PATCH 0/3] [media] Freescale VIU: Adjustments for five function implementations SF Markus Elfring
2017-09-08 19:42 ` [PATCH 1/3] [media] fsl-viu: Delete an error message for a failed memory allocation in viu_of_probe() SF Markus Elfring
@ 2017-09-08 19:44 ` SF Markus Elfring
2017-09-08 19:46 ` [PATCH 3/3] [media] fsl-viu: Adjust six checks for null pointers SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-08 19:44 UTC (permalink / raw)
To: linux-media, Arvind Yadav, Bhumika Goyal, Geliang Tang,
Hans Verkuil, Mauro Carvalho Chehab, Prabhakar Lad
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 8 Sep 2017 21:12:52 +0200
Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/platform/fsl-viu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index 526f80649864..1fe2a295db93 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -1421,5 +1421,5 @@ static int viu_of_probe(struct platform_device *op)
}
/* remap registers */
- viu_regs = devm_ioremap(&op->dev, r.start, sizeof(struct viu_reg));
+ viu_regs = devm_ioremap(&op->dev, r.start, sizeof(*viu_regs));
if (!viu_regs) {
@@ -1429,5 +1429,5 @@ static int viu_of_probe(struct platform_device *op)
}
/* Prepare our private structure */
- viu_dev = devm_kzalloc(&op->dev, sizeof(struct viu_dev), GFP_ATOMIC);
+ viu_dev = devm_kzalloc(&op->dev, sizeof(*viu_dev), GFP_ATOMIC);
if (!viu_dev) {
--
2.14.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] [media] fsl-viu: Adjust six checks for null pointers
2017-09-08 19:40 [PATCH 0/3] [media] Freescale VIU: Adjustments for five function implementations SF Markus Elfring
2017-09-08 19:42 ` [PATCH 1/3] [media] fsl-viu: Delete an error message for a failed memory allocation in viu_of_probe() SF Markus Elfring
2017-09-08 19:44 ` [PATCH 2/3] [media] fsl-viu: Improve two size determinations " SF Markus Elfring
@ 2017-09-08 19:46 ` SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-09-08 19:46 UTC (permalink / raw)
To: linux-media, Arvind Yadav, Bhumika Goyal, Geliang Tang,
Hans Verkuil, Mauro Carvalho Chehab, Prabhakar Lad
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 8 Sep 2017 21:16:50 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written !…
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/platform/fsl-viu.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index 1fe2a295db93..a133dfdd869a 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -313,7 +313,7 @@ static int restart_video_queue(struct viu_dmaqueue *vidq)
if (list_empty(&vidq->queued))
return 0;
buf = list_entry(vidq->queued.next, struct viu_buf, vb.queue);
- if (prev == NULL) {
+ if (!prev) {
list_move_tail(&buf->vb.queue, &vidq->active);
dprintk(1, "Restarting video dma\n");
@@ -450,7 +450,7 @@ static int buffer_prepare(struct videobuf_queue *vq,
struct viu_buf *buf = container_of(vb, struct viu_buf, vb);
int rc;
- BUG_ON(fh->fmt == NULL);
+ BUG_ON(!fh->fmt);
if (fh->width < 48 || fh->width > norm_maxw() ||
fh->height < 32 || fh->height > norm_maxh())
@@ -668,9 +668,9 @@ static int verify_preview(struct viu_dev *dev, struct v4l2_window *win)
enum v4l2_field field;
int maxw, maxh;
- if (dev->ovbuf.base == NULL)
+ if (!dev->ovbuf.base)
return -EINVAL;
- if (dev->ovfmt == NULL)
+ if (!dev->ovfmt)
return -EINVAL;
if (win->w.width < 48 || win->w.height < 32)
return -EINVAL;
@@ -825,7 +825,7 @@ int vidioc_s_fbuf(struct file *file, void *priv, const struct v4l2_framebuffer *
/* check args */
fmt = format_by_fourcc(fb->fmt.pixelformat);
- if (fmt == NULL)
+ if (!fmt)
return -EINVAL;
/* ok, accept it */
@@ -1472,7 +1472,7 @@ static int viu_of_probe(struct platform_device *op)
/* Allocate memory for video device */
vdev = video_device_alloc();
- if (vdev == NULL) {
+ if (!vdev) {
ret = -ENOMEM;
goto err_vdev;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-08 19:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08 19:40 [PATCH 0/3] [media] Freescale VIU: Adjustments for five function implementations SF Markus Elfring
2017-09-08 19:42 ` [PATCH 1/3] [media] fsl-viu: Delete an error message for a failed memory allocation in viu_of_probe() SF Markus Elfring
2017-09-08 19:44 ` [PATCH 2/3] [media] fsl-viu: Improve two size determinations " SF Markus Elfring
2017-09-08 19:46 ` [PATCH 3/3] [media] fsl-viu: Adjust six checks for null pointers SF Markus Elfring
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).