* [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations
@ 2017-09-04 20:04 SF Markus Elfring
2017-09-04 20:05 ` [PATCH 1/6] [media] atmel-isc: Delete an error message for a failed memory allocation in isc_formats_init() SF Markus Elfring
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-04 20:04 UTC (permalink / raw)
To: linux-media, Ludovic Desroches, Mauro Carvalho Chehab, Songjun Wu
Cc: LKML, kernel-janitors
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/6] [media] atmel-isc: Delete an error message for a failed memory allocation in isc_formats_init()
2017-09-04 20:04 [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations SF Markus Elfring
@ 2017-09-04 20:05 ` SF Markus Elfring
2017-09-04 20:07 ` [PATCH 2/6] [media] atmel-isc: Improve a size determination " SF Markus Elfring
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-04 20:05 UTC (permalink / raw)
To: linux-media, Ludovic Desroches, Mauro Carvalho Chehab, Songjun Wu
Cc: LKML, kernel-janitors
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/6] [media] atmel-isc: Improve a size determination in isc_formats_init()
2017-09-04 20:04 [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations SF Markus Elfring
2017-09-04 20:05 ` [PATCH 1/6] [media] atmel-isc: Delete an error message for a failed memory allocation in isc_formats_init() SF Markus Elfring
@ 2017-09-04 20:07 ` SF Markus Elfring
2017-09-04 20:08 ` [PATCH 3/6] [media] atmel-isc: Adjust three checks for null pointers SF Markus Elfring
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-04 20:07 UTC (permalink / raw)
To: linux-media, Ludovic Desroches, Mauro Carvalho Chehab, Songjun Wu
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 4 Sep 2017 20:50:22 +0200
Replace the specification of a data type 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/media/platform/atmel/atmel-isc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c
index f1e635edef72..f16bab0105c2 100644
--- a/drivers/media/platform/atmel/atmel-isc.c
+++ b/drivers/media/platform/atmel/atmel-isc.c
@@ -1505,6 +1505,6 @@ static int isc_formats_init(struct isc_device *isc)
isc->num_user_formats = num_fmts;
isc->user_formats = devm_kcalloc(isc->dev,
- num_fmts, sizeof(struct isc_format *),
+ num_fmts, sizeof(*isc->user_formats),
GFP_KERNEL);
if (!isc->user_formats)
--
2.14.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/6] [media] atmel-isc: Adjust three checks for null pointers
2017-09-04 20:04 [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations SF Markus Elfring
2017-09-04 20:05 ` [PATCH 1/6] [media] atmel-isc: Delete an error message for a failed memory allocation in isc_formats_init() SF Markus Elfring
2017-09-04 20:07 ` [PATCH 2/6] [media] atmel-isc: Improve a size determination " SF Markus Elfring
@ 2017-09-04 20:08 ` SF Markus Elfring
2017-09-04 20:10 ` [PATCH 4/6] [media] atmel-isi: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-04 20:08 UTC (permalink / raw)
To: linux-media, Ludovic Desroches, Mauro Carvalho Chehab, Songjun Wu
Cc: LKML, kernel-janitors
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/6] [media] atmel-isi: Delete an error message for a failed memory allocation in two functions
2017-09-04 20:04 [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations SF Markus Elfring
` (2 preceding siblings ...)
2017-09-04 20:08 ` [PATCH 3/6] [media] atmel-isc: Adjust three checks for null pointers SF Markus Elfring
@ 2017-09-04 20:10 ` SF Markus Elfring
2017-09-04 20:11 ` [PATCH 5/6] [media] atmel-isi: Improve three size determinations SF Markus Elfring
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-04 20:10 UTC (permalink / raw)
To: linux-media, Ludovic Desroches, Mauro Carvalho Chehab, Songjun Wu
Cc: LKML, kernel-janitors
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/6] [media] atmel-isi: Improve three size determinations
2017-09-04 20:04 [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations SF Markus Elfring
` (3 preceding siblings ...)
2017-09-04 20:10 ` [PATCH 4/6] [media] atmel-isi: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
@ 2017-09-04 20:11 ` SF Markus Elfring
2017-09-04 20:12 ` [PATCH 6/6] [media] atmel-isi: Adjust a null pointer check in three functions SF Markus Elfring
2017-09-06 0:58 ` [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations Yang, Wenyou
6 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-04 20:11 UTC (permalink / raw)
To: linux-media, Ludovic Desroches, Mauro Carvalho Chehab, Songjun Wu
Cc: LKML, kernel-janitors
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/6] [media] atmel-isi: Adjust a null pointer check in three functions
2017-09-04 20:04 [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations SF Markus Elfring
` (4 preceding siblings ...)
2017-09-04 20:11 ` [PATCH 5/6] [media] atmel-isi: Improve three size determinations SF Markus Elfring
@ 2017-09-04 20:12 ` SF Markus Elfring
2017-09-06 0:58 ` [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations Yang, Wenyou
6 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-04 20:12 UTC (permalink / raw)
To: linux-media, Ludovic Desroches, Mauro Carvalho Chehab, Songjun Wu
Cc: LKML, kernel-janitors
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations
2017-09-04 20:04 [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations SF Markus Elfring
` (5 preceding siblings ...)
2017-09-04 20:12 ` [PATCH 6/6] [media] atmel-isi: Adjust a null pointer check in three functions SF Markus Elfring
@ 2017-09-06 0:58 ` Yang, Wenyou
2017-09-06 5:59 ` Ludovic Desroches
6 siblings, 1 reply; 9+ messages in thread
From: Yang, Wenyou @ 2017-09-06 0:58 UTC (permalink / raw)
To: SF Markus Elfring, linux-media, Ludovic Desroches,
Mauro Carvalho Chehab, Songjun Wu
Cc: LKML, kernel-janitors
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations
2017-09-06 0:58 ` [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations Yang, Wenyou
@ 2017-09-06 5:59 ` Ludovic Desroches
0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Desroches @ 2017-09-06 5:59 UTC (permalink / raw)
To: Yang, Wenyou
Cc: SF Markus Elfring, linux-media, Ludovic Desroches,
Mauro Carvalho Chehab, Songjun Wu, LKML, kernel-janitors
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
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-09-06 6:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-04 20:04 [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations SF Markus Elfring
2017-09-04 20:05 ` [PATCH 1/6] [media] atmel-isc: Delete an error message for a failed memory allocation in isc_formats_init() SF Markus Elfring
2017-09-04 20:07 ` [PATCH 2/6] [media] atmel-isc: Improve a size determination " SF Markus Elfring
2017-09-04 20:08 ` [PATCH 3/6] [media] atmel-isc: Adjust three checks for null pointers SF Markus Elfring
2017-09-04 20:10 ` [PATCH 4/6] [media] atmel-isi: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2017-09-04 20:11 ` [PATCH 5/6] [media] atmel-isi: Improve three size determinations SF Markus Elfring
2017-09-04 20:12 ` [PATCH 6/6] [media] atmel-isi: Adjust a null pointer check in three functions SF Markus Elfring
2017-09-06 0:58 ` [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations Yang, Wenyou
2017-09-06 5:59 ` Ludovic Desroches
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).