* [PATCH 0/2] [media] blackfin-capture: Fine-tuning for two function implementations
@ 2016-10-09 19:55 SF Markus Elfring
2016-10-09 19:56 ` [PATCH 1/2] [media] blackfin-capture: Use kcalloc() in bcap_init_sensor_formats() SF Markus Elfring
2016-10-09 19:58 ` [PATCH 2/2] [media] blackfin-capture: Delete an error message for a failed memory allocation SF Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2016-10-09 19:55 UTC (permalink / raw)
To: adi-buildroot-devel, linux-media, Hans Verkuil,
Mauro Carvalho Chehab, Lad, Prabhakar, Scott Jiang
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 9 Oct 2016 21:44:33 +0200
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Use kcalloc() in bcap_init_sensor_formats()
Delete an error message for a failed memory allocation in bcap_probe()
drivers/media/platform/blackfin/bfin_capture.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--
2.10.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] [media] blackfin-capture: Use kcalloc() in bcap_init_sensor_formats()
2016-10-09 19:55 [PATCH 0/2] [media] blackfin-capture: Fine-tuning for two function implementations SF Markus Elfring
@ 2016-10-09 19:56 ` SF Markus Elfring
2016-10-09 19:58 ` [PATCH 2/2] [media] blackfin-capture: Delete an error message for a failed memory allocation SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2016-10-09 19:56 UTC (permalink / raw)
To: adi-buildroot-devel, linux-media, Hans Verkuil,
Mauro Carvalho Chehab, Lad, Prabhakar, Scott Jiang
Cc: LKML, kernel-janitors, Julia Lawall
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 9 Oct 2016 21:12:13 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/platform/blackfin/bfin_capture.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
index 8eb0339..c5e1043 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -169,7 +169,7 @@ static int bcap_init_sensor_formats(struct bcap_device *bcap_dev)
if (!num_formats)
return -ENXIO;
- sf = kzalloc(num_formats * sizeof(*sf), GFP_KERNEL);
+ sf = kcalloc(num_formats, sizeof(*sf), GFP_KERNEL);
if (!sf)
return -ENOMEM;
--
2.10.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] [media] blackfin-capture: Delete an error message for a failed memory allocation
2016-10-09 19:55 [PATCH 0/2] [media] blackfin-capture: Fine-tuning for two function implementations SF Markus Elfring
2016-10-09 19:56 ` [PATCH 1/2] [media] blackfin-capture: Use kcalloc() in bcap_init_sensor_formats() SF Markus Elfring
@ 2016-10-09 19:58 ` SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2016-10-09 19:58 UTC (permalink / raw)
To: adi-buildroot-devel, linux-media, Hans Verkuil,
Mauro Carvalho Chehab, Lad, Prabhakar, Scott Jiang
Cc: LKML, kernel-janitors, Julia Lawall, Wolfram Sang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 9 Oct 2016 21:30:18 +0200
The script "checkpatch.pl" pointed information out like the following.
WARNING: Possible unnecessary 'out of memory' message
Thus remove such a statement here.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/platform/blackfin/bfin_capture.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
index c5e1043..2e6edc0 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -802,10 +802,8 @@ static int bcap_probe(struct platform_device *pdev)
}
bcap_dev = kzalloc(sizeof(*bcap_dev), GFP_KERNEL);
- if (!bcap_dev) {
- v4l2_err(pdev->dev.driver, "Unable to alloc bcap_dev\n");
+ if (!bcap_dev)
return -ENOMEM;
- }
bcap_dev->cfg = config;
--
2.10.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-09 19:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-09 19:55 [PATCH 0/2] [media] blackfin-capture: Fine-tuning for two function implementations SF Markus Elfring
2016-10-09 19:56 ` [PATCH 1/2] [media] blackfin-capture: Use kcalloc() in bcap_init_sensor_formats() SF Markus Elfring
2016-10-09 19:58 ` [PATCH 2/2] [media] blackfin-capture: Delete an error message for a failed memory allocation 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).