Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1738130 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-09-24 12:30 +0200 |
| Last post | 2017-09-24 12:40 +0200 |
| Articles | 7 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/6] [media] omap_vout: Adjustments for three function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:30 +0200
[PATCH 1/6] [media] omap_vout: Delete an error message for a failed memory allocation in omap_vout_create_video_devices() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:30 +0200
Re: [PATCH 1/6] [media] omap_vout: Delete an error message for a failed memory allocation in omap_vout_create_video_devices() Joe Perches <joe@perches.com> - 2017-09-24 12:40 +0200
[PATCH 3/6] [media] omap_vout: Adjust a null pointer check in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:30 +0200
[PATCH 2/6] [media] omap_vout: Improve a size determination in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:30 +0200
[PATCH 6/6] [media] omap_vout: Delete two unnecessary variable initialisations in omap_vout_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:40 +0200
[PATCH 5/6] [media] omap_vout: Delete an unnecessary variable initialisation in omap_vout_open() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-24 12:40 +0200
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-24 12:30 +0200 |
| Subject | [PATCH 0/6] [media] omap_vout: Adjustments for three function implementations |
| Message-ID | <utckF-7vc-9@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 24 Sep 2017 12:06:54 +0200 A few update suggestions were taken into account from static source code analysis. Markus Elfring (6): Delete an error message for a failed memory allocation in omap_vout_create_video_devices() Improve a size determination in two functions Adjust a null pointer check in two functions Fix a possible null pointer dereference in omap_vout_open() Delete an unnecessary variable initialisation in omap_vout_open() Delete two unnecessary variable initialisations in omap_vout_probe() drivers/media/platform/omap/omap_vout.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) -- 2.14.1
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-24 12:30 +0200 |
| Subject | [PATCH 1/6] [media] omap_vout: Delete an error message for a failed memory allocation in omap_vout_create_video_devices() |
| Message-ID | <utckG-7vc-23@gated-at.bofh.it> |
| In reply to | #1738130 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 24 Sep 2017 10:08: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/omap/omap_vout.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
index 4d29860d27b4..aebc1e628ac5 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -1948,7 +1948,5 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev)
- if (!vout) {
- dev_err(&pdev->dev, ": could not allocate memory\n");
+ if (!vout)
return -ENOMEM;
- }
vout->vid = k;
vid_dev->vouts[k] = vout;
--
2.14.1
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-09-24 12:40 +0200 |
| Subject | Re: [PATCH 1/6] [media] omap_vout: Delete an error message for a failed memory allocation in omap_vout_create_video_devices() |
| Message-ID | <utcul-7yW-11@gated-at.bofh.it> |
| In reply to | #1738131 |
On Sun, 2017-09-24 at 12:22 +0200, SF Markus Elfring wrote:
> Omit an extra message for a memory allocation failure in this function.
[]
> diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
[]
> @@ -1948,7 +1948,5 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev)
> - if (!vout) {
> - dev_err(&pdev->dev, ": could not allocate memory\n");
> + if (!vout)
> return -ENOMEM;
> - }
>
> vout->vid = k;
> vid_dev->vouts[k] = vout;
Use normal patch styles.
Fix your tools before you send any more patches.
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-24 12:30 +0200 |
| Subject | [PATCH 3/6] [media] omap_vout: Adjust a null pointer check in two functions |
| Message-ID | <utckF-7vc-7@gated-at.bofh.it> |
| In reply to | #1738130 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 24 Sep 2017 10:30:29 +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/omap/omap_vout.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
index 4a4d171ca573..2b55a8ebd1ad 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -1006,7 +1006,7 @@ static int omap_vout_open(struct file *file)
vout = video_drvdata(file);
v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Entering %s\n", __func__);
- if (vout == NULL)
+ if (!vout)
return -ENODEV;
/* for now, we only support single open */
@@ -2095,7 +2095,7 @@ static int __init omap_vout_probe(struct platform_device *pdev)
}
vid_dev = kzalloc(sizeof(*vid_dev), GFP_KERNEL);
- if (vid_dev == NULL) {
+ if (!vid_dev) {
ret = -ENOMEM;
goto err_dss_init;
}
--
2.14.1
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-24 12:30 +0200 |
| Subject | [PATCH 2/6] [media] omap_vout: Improve a size determination in two functions |
| Message-ID | <utckF-7vc-11@gated-at.bofh.it> |
| In reply to | #1738130 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 24 Sep 2017 10:18:26 +0200
Replace the specification of data structures by variable references
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/omap/omap_vout.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
index aebc1e628ac5..4a4d171ca573 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -1943,8 +1943,7 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev)
struct omap2video_device, v4l2_dev);
for (k = 0; k < pdev->num_resources; k++) {
-
- vout = kzalloc(sizeof(struct omap_vout_device), GFP_KERNEL);
+ vout = kzalloc(sizeof(*vout), GFP_KERNEL);
if (!vout)
return -ENOMEM;
@@ -2095,7 +2094,7 @@ static int __init omap_vout_probe(struct platform_device *pdev)
goto err_dss_init;
}
- vid_dev = kzalloc(sizeof(struct omap2video_device), GFP_KERNEL);
+ vid_dev = kzalloc(sizeof(*vid_dev), GFP_KERNEL);
if (vid_dev == NULL) {
ret = -ENOMEM;
goto err_dss_init;
--
2.14.1
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-24 12:40 +0200 |
| Subject | [PATCH 6/6] [media] omap_vout: Delete two unnecessary variable initialisations in omap_vout_probe() |
| Message-ID | <utcul-7yW-1@gated-at.bofh.it> |
| In reply to | #1738130 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 24 Sep 2017 11:33:39 +0200
The variables "dssdev" and "vid_dev" will eventually be set
to appropriate pointers a bit later.
Thus omit the explicit initialisations at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/platform/omap/omap_vout.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
index f446a37064f4..0efcea820007 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -2075,9 +2075,9 @@ static int __init omap_vout_probe(struct platform_device *pdev)
{
int ret = 0, i;
struct omap_overlay *ovl;
- struct omap_dss_device *dssdev = NULL;
+ struct omap_dss_device *dssdev;
struct omap_dss_device *def_display;
- struct omap2video_device *vid_dev = NULL;
+ struct omap2video_device *vid_dev;
if (omapdss_is_initialized() == false)
return -EPROBE_DEFER;
--
2.14.1
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-24 12:40 +0200 |
| Subject | [PATCH 5/6] [media] omap_vout: Delete an unnecessary variable initialisation in omap_vout_open() |
| Message-ID | <utcul-7yW-7@gated-at.bofh.it> |
| In reply to | #1738130 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 24 Sep 2017 11:20:11 +0200
The local variable "vout" is reassigned by a statement at the beginning.
Thus omit the explicit initialisation.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/platform/omap/omap_vout.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
index 71b77426271e..f446a37064f4 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -1001,7 +1001,7 @@ static int omap_vout_release(struct file *file)
static int omap_vout_open(struct file *file)
{
struct videobuf_queue *q;
- struct omap_vout_device *vout = NULL;
+ struct omap_vout_device *vout;
vout = video_drvdata(file);
if (!vout)
--
2.14.1
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web