blackfin-capture: Fine-tuning for two function implementations
Subsystems (2)
cover blackfin-capture: Fine-tuning for two function implementations
From: Markus Elfring <[email protected]>
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(-)
Signature · 1 line
2.10.1
PATCH 1/2 blackfin-capture: Use kcalloc() in bcap_init_sensor_formats()
From: Markus Elfring <[email protected]>
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.
--- drivers/media/platform/blackfin/bfin_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/blackfin/bfin_capture.c +1 -1
@@ -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 ;
Signature · 1 line
2.10.1
PATCH 2/2 blackfin-capture: Delete an error message for a failed memory allocation
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/media/platform/blackfin/bfin_capture.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/blackfin/bfin_capture.c +1 -3
@@ -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;
Signature · 1 line
2.10.1