Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1726248 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-09-04 22:10 +0200 |
| Last post | 2017-09-06 08:10 +0200 |
| Articles | 8 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 0/6] [media] Atmel: Adjustments for seven function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-04 22:10 +0200
[PATCH 1/6] [media] atmel-isc: Delete an error message for a failed memory allocation in isc_formats_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-04 22:10 +0200
[PATCH 3/6] [media] atmel-isc: Adjust three checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-04 22:10 +0200
[PATCH 4/6] [media] atmel-isi: Delete an error message for a failed memory allocation in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-04 22:20 +0200
[PATCH 5/6] [media] atmel-isi: Improve three size determinations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-04 22:20 +0200
[PATCH 6/6] [media] atmel-isi: Adjust a null pointer check in three functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-04 22:20 +0200
Re: [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations "Yang, Wenyou" <Wenyou.Yang@Microchip.com> - 2017-09-06 03:00 +0200
Re: [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations Ludovic Desroches <ludovic.desroches@microchip.com> - 2017-09-06 08:10 +0200
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-04 22:10 +0200 |
| Subject | [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations |
| Message-ID | <um5R0-1xP-11@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 4 Sep 2017 21:44:55 +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 isc_formats_init() Improve a size determination in isc_formats_init() Adjust three checks for null pointers Delete an error message for a failed memory allocation in two functions Improve three size determinations Adjust a null pointer check in three functions drivers/media/platform/atmel/atmel-isc.c | 12 +++++------- drivers/media/platform/atmel/atmel-isi.c | 20 ++++++++------------ 2 files changed, 13 insertions(+), 19 deletions(-) -- 2.14.1
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-04 22:10 +0200 |
| Subject | [PATCH 1/6] [media] atmel-isc: Delete an error message for a failed memory allocation in isc_formats_init() |
| Message-ID | <um5R0-1xP-15@gated-at.bofh.it> |
| In reply to | #1726248 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 4 Sep 2017 20:33:58 +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/atmel/atmel-isc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c
index d4df3d4ccd85..f1e635edef72 100644
--- a/drivers/media/platform/atmel/atmel-isc.c
+++ b/drivers/media/platform/atmel/atmel-isc.c
@@ -1510,7 +1510,5 @@ static int isc_formats_init(struct isc_device *isc)
- if (!isc->user_formats) {
- v4l2_err(&isc->v4l2_dev, "could not allocate memory\n");
+ if (!isc->user_formats)
return -ENOMEM;
- }
fmt = &isc_formats[0];
for (i = 0, j = 0; i < ARRAY_SIZE(isc_formats); i++) {
--
2.14.1
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-04 22:10 +0200 |
| Subject | [PATCH 3/6] [media] atmel-isc: Adjust three checks for null pointers |
| Message-ID | <um5R0-1xP-17@gated-at.bofh.it> |
| In reply to | #1726248 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 4 Sep 2017 20:54:20 +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/atmel/atmel-isc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c
index f16bab0105c2..b6048cedb6cc 100644
--- a/drivers/media/platform/atmel/atmel-isc.c
+++ b/drivers/media/platform/atmel/atmel-isc.c
@@ -1590,7 +1590,7 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
spin_lock_init(&isc->dma_queue_lock);
sd_entity->config = v4l2_subdev_alloc_pad_config(sd_entity->sd);
- if (sd_entity->config == NULL)
+ if (!sd_entity->config)
return -ENOMEM;
ret = isc_formats_init(isc);
@@ -1714,7 +1714,7 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
subdev_entity = devm_kzalloc(dev,
sizeof(*subdev_entity), GFP_KERNEL);
- if (subdev_entity == NULL) {
+ if (!subdev_entity) {
of_node_put(rem);
ret = -ENOMEM;
break;
@@ -1722,7 +1722,7 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
subdev_entity->asd = devm_kzalloc(dev,
sizeof(*subdev_entity->asd), GFP_KERNEL);
- if (subdev_entity->asd == NULL) {
+ if (!subdev_entity->asd) {
of_node_put(rem);
ret = -ENOMEM;
break;
--
2.14.1
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-04 22:20 +0200 |
| Subject | [PATCH 4/6] [media] atmel-isi: Delete an error message for a failed memory allocation in two functions |
| Message-ID | <um60F-1AM-3@gated-at.bofh.it> |
| In reply to | #1726248 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 4 Sep 2017 21:21:25 +0200
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/platform/atmel/atmel-isi.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c
index 891fa2505efa..154e9c39b64f 100644
--- a/drivers/media/platform/atmel/atmel-isi.c
+++ b/drivers/media/platform/atmel/atmel-isi.c
@@ -1041,7 +1041,5 @@ static int isi_formats_init(struct atmel_isi *isi)
- if (!isi->user_formats) {
- dev_err(isi->dev, "could not allocate memory\n");
+ if (!isi->user_formats)
return -ENOMEM;
- }
memcpy(isi->user_formats, isi_fmts,
num_fmts * sizeof(struct isi_format *));
@@ -1179,7 +1177,5 @@ static int atmel_isi_probe(struct platform_device *pdev)
- if (!isi) {
- dev_err(&pdev->dev, "Can't allocate interface!\n");
+ if (!isi)
return -ENOMEM;
- }
isi->pclk = devm_clk_get(&pdev->dev, "isi_clk");
if (IS_ERR(isi->pclk))
--
2.14.1
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-04 22:20 +0200 |
| Subject | [PATCH 5/6] [media] atmel-isi: Improve three size determinations |
| Message-ID | <um60F-1AM-7@gated-at.bofh.it> |
| In reply to | #1726248 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 4 Sep 2017 21:27:45 +0200 Replace the specification of data types 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. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/media/platform/atmel/atmel-isi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c index 154e9c39b64f..ac40defce1e7 100644 --- a/drivers/media/platform/atmel/atmel-isi.c +++ b/drivers/media/platform/atmel/atmel-isi.c @@ -1036,13 +1036,13 @@ static int isi_formats_init(struct atmel_isi *isi) isi->num_user_formats = num_fmts; isi->user_formats = devm_kcalloc(isi->dev, - num_fmts, sizeof(struct isi_format *), + num_fmts, sizeof(*isi->user_formats), GFP_KERNEL); if (!isi->user_formats) return -ENOMEM; memcpy(isi->user_formats, isi_fmts, - num_fmts * sizeof(struct isi_format *)); + num_fmts * sizeof(*isi->user_formats)); isi->current_fmt = isi->user_formats[0]; return 0; @@ -1173,5 +1173,5 @@ static int atmel_isi_probe(struct platform_device *pdev) struct resource *regs; int ret, i; - isi = devm_kzalloc(&pdev->dev, sizeof(struct atmel_isi), GFP_KERNEL); + isi = devm_kzalloc(&pdev->dev, sizeof(*isi), GFP_KERNEL); if (!isi) -- 2.14.1
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-09-04 22:20 +0200 |
| Subject | [PATCH 6/6] [media] atmel-isi: Adjust a null pointer check in three functions |
| Message-ID | <um60G-1AM-11@gated-at.bofh.it> |
| In reply to | #1726248 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 4 Sep 2017 21:30:48 +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/atmel/atmel-isi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c
index ac40defce1e7..f2e13dfb19a1 100644
--- a/drivers/media/platform/atmel/atmel-isi.c
+++ b/drivers/media/platform/atmel/atmel-isi.c
@@ -411,7 +411,7 @@ static void buffer_queue(struct vb2_buffer *vb)
spin_lock_irqsave(&isi->irqlock, flags);
list_add_tail(&buf->list, &isi->video_buffer_list);
- if (isi->active == NULL) {
+ if (!isi->active) {
isi->active = buf;
if (vb2_is_streaming(vb->vb2_queue))
start_dma(isi, buf);
@@ -1141,7 +1141,7 @@ static int isi_graph_init(struct atmel_isi *isi)
/* Register the subdevices notifier. */
subdevs = devm_kzalloc(isi->dev, sizeof(*subdevs), GFP_KERNEL);
- if (subdevs == NULL) {
+ if (!subdevs) {
of_node_put(isi->entity.node);
return -ENOMEM;
}
@@ -1200,7 +1200,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
return ret;
isi->vdev = video_device_alloc();
- if (isi->vdev == NULL) {
+ if (!isi->vdev) {
ret = -ENOMEM;
goto err_vdev_alloc;
}
--
2.14.1
[toc] | [prev] | [next] | [standalone]
| From | "Yang, Wenyou" <Wenyou.Yang@Microchip.com> |
|---|---|
| Date | 2017-09-06 03:00 +0200 |
| Message-ID | <umwRb-1Zw-5@gated-at.bofh.it> |
| In reply to | #1726248 |
Hi, On 2017/9/5 4:04, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 4 Sep 2017 21:44:55 +0200 > > A few update suggestions were taken into account > from static source code analysis. Thank you for your patches. You can add my Acked-by for the patch series. Acked-by: Wenyou Yang <wenyou.yang@microchip.com> > > Markus Elfring (6): > Delete an error message for a failed memory allocation in isc_formats_init() > Improve a size determination in isc_formats_init() > Adjust three checks for null pointers > Delete an error message for a failed memory allocation in two functions > Improve three size determinations > Adjust a null pointer check in three functions > > drivers/media/platform/atmel/atmel-isc.c | 12 +++++------- > drivers/media/platform/atmel/atmel-isi.c | 20 ++++++++------------ > 2 files changed, 13 insertions(+), 19 deletions(-) > Best Regards, Wenyou Yang
[toc] | [prev] | [next] | [standalone]
| From | Ludovic Desroches <ludovic.desroches@microchip.com> |
|---|---|
| Date | 2017-09-06 08:10 +0200 |
| Message-ID | <umBHb-5FI-7@gated-at.bofh.it> |
| In reply to | #1727097 |
On Wed, Sep 06, 2017 at 08:58:26AM +0800, Yang, Wenyou wrote: > Hi, > > > On 2017/9/5 4:04, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > > Date: Mon, 4 Sep 2017 21:44:55 +0200 > > > > A few update suggestions were taken into account > > from static source code analysis. > Thank you for your patches. > > You can add my Acked-by for the patch series. > > Acked-by: Wenyou Yang <wenyou.yang@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> > > > > > Markus Elfring (6): > > Delete an error message for a failed memory allocation in isc_formats_init() > > Improve a size determination in isc_formats_init() > > Adjust three checks for null pointers > > Delete an error message for a failed memory allocation in two functions > > Improve three size determinations > > Adjust a null pointer check in three functions > > > > drivers/media/platform/atmel/atmel-isc.c | 12 +++++------- > > drivers/media/platform/atmel/atmel-isi.c | 20 ++++++++------------ > > 2 files changed, 13 insertions(+), 19 deletions(-) > > > > Best Regards, > Wenyou Yang
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web