DaVinci-Video Processing: Fine-tuning for several function implementations
Subsystems (2)
cover DaVinci-Video Processing: Fine-tuning for several function implementations
From: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 16:20:02 +0200
Several update suggestions were taken into account from static source code analysis.
Markus Elfring (34):
Use kmalloc_array() in vpbe_initialize()
Delete two error messages for a failed memory allocation
Adjust 16 checks for null pointers
Combine substrings for four messages
Return an error code only as a constant in vpbe_probe()
Return an error code only by a single variable in vpbe_initialize() Delete an unnecessary variable initialisation in vpbe_initialize() Return the success indication only as a constant in vpbe_set_mode() Reduce the scope for a variable in vpbe_set_default_output()
Check return value of a setup_if_config() call in vpbe_set_output() Rename a jump label in vpbe_set_output()
Delete an unnecessary variable initialisation in vpbe_set_output()
Capture: Use kmalloc_array() in vpfe_probe()
Capture: Delete three error messages for a failed memory allocation
Capture: Improve another size determination in vpfe_probe()
Capture: Delete an unnecessary variable initialisation in vpfe_probe()
Capture: Improve another size determination in vpfe_enum_input()
Capture: Combine substrings for an error message in vpfe_enum_input()
Capture: Improve another size determination in vpfe_open()
Capture: Adjust 13 checks for null pointers
Capture: Delete an unnecessary variable initialisation in 11 functions
Capture: Move two assignments in vpfe_s_input()
Capture: Delete unnecessary braces in vpfe_isr()
Capture: Delete an unnecessary return statement in vpfe_unregister_ccdc_device()
Capture: Use kcalloc() in vpif_probe()
Capture: Delete an error message for a failed memory allocation
Capture: Adjust ten checks for null pointers
Capture: Delete an unnecessary variable initialisation in vpif_querystd()
Capture: Delete an unnecessary variable initialisation in vpif_channel_isr()
Display: Use kcalloc() in vpif_probe()
Display: Delete an error message for a failed memory allocation
Display: Adjust 11 checks for null pointers
Display: Delete an unnecessary variable initialisation in vpif_channel_isr()
Display: Delete an unnecessary variable initialisation in process_progressive_mode()
drivers/media/platform/davinci/vpbe.c | 93 ++++++++++++--------------- drivers/media/platform/davinci/vpfe_capture.c | 88 ++++++++++++------------- drivers/media/platform/davinci/vpif_capture.c | 28 ++++---- drivers/media/platform/davinci/vpif_display.c | 30 ++++----- 4 files changed, 109 insertions(+), 130 deletions(-)
Signature · 1 line
2.10.1
PATCH 1/34 DaVinci-VPBE: Use kmalloc_array() in vpbe_initialize()
From: Markus Elfring <[email protected]>
Date: Tue, 11 Oct 2016 09:40:41 +0200
* A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention.
--- drivers/media/platform/davinci/vpbe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/davinci/vpbe.c +3 -3
@@ -676,9 +676,9 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)* store venc sd index. */ num_encoders = vpbe_dev->cfg->num_ext_encoders +1 ; - vpbe_dev->encoders =kmalloc ( -sizeof (struct v4l2_subdev *)*num_encoders, -GFP_KERNEL ); + vpbe_dev->encoders =kmalloc_array (num_encoders, +sizeof (*vpbe_dev->encoders), +GFP_KERNEL ); if (NULL = vpbe_dev->encoders) {v4l2_err (&vpbe_dev->v4l2_dev,"unable to allocate memory for encoders sub devices" );
Signature · 1 line
2.10.1
PATCH 2/34 DaVinci-VPBE: Delete two error messages for a failed memory allocation
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Tue, 11 Oct 2016 09:56:13 +0200
The script "checkpatch.pl" pointed information out like the following.
WARNING: Possible unnecessary 'out of memory' message
Thus remove such a logging statement in two functions.
--- drivers/media/platform/davinci/vpbe.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/media/platform/davinci/vpbe.c +2 -6
@@ -680,8 +680,6 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)sizeof (*vpbe_dev->encoders), GFP_KERNEL); if (NULL = vpbe_dev->encoders) { -v4l2_err (&vpbe_dev->v4l2_dev, -"unable to allocate memory for encoders sub devices" ); ret = -ENOMEM ; goto fail_dev_unregister; }
@@ -841,11 +839,9 @@ static int vpbe_probe(struct platform_device *pdev) } vpbe_dev =kzalloc (sizeof (*vpbe_dev),GFP_KERNEL ); -if (vpbe_dev =NULL ) { -v4l2_err (pdev->dev.driver,"Unable to allocate memory" -" for vpbe_device\n" ); +if (!vpbe_dev)return -ENOMEM ; - } + vpbe_dev->cfg = cfg; vpbe_dev->ops = vpbe_dev_ops; vpbe_dev->pdev = &pdev->dev;
Signature · 1 line
2.10.1
PATCH 4/34 DaVinci-VPBE: Combine substrings for four messages
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Tue, 11 Oct 2016 13:40:14 +0200
The script "checkpatch.pl" pointed information out like the following.
WARNING: quoted string split across lines
Thus fix the affected source code places.
--- drivers/media/platform/davinci/vpbe.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/media/platform/davinci/vpbe.c +9 -9
@@ -702,15 +702,15 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)"v4l2 sub device %s registered\n" , enc_info->module_name); else { -v4l2_err (&vpbe_dev->v4l2_dev,"encoder %s" -" failed to register" , +v4l2_err (&vpbe_dev->v4l2_dev, +"encoder %s failed to register" , enc_info->module_name); ret = -ENODEV ; goto fail_kfree_encoders; } }else -v4l2_warn (&vpbe_dev->v4l2_dev,"non-i2c encoders" -" currently not supported" ); +v4l2_warn (&vpbe_dev->v4l2_dev, +"non-i2c encoders currently not supported" ); }/* Add amplifier subdevice for dm365 */ if ((strcmp(vpbe_dev->cfg->module_name, "dm365-vpbe-display") = 0) &&
@@ -731,9 +731,9 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)"v4l2 sub device %s registered\n" , amp_info->module_name); }else { - vpbe_dev->amp =NULL ; -v4l2_warn (&vpbe_dev->v4l2_dev,"non-i2c amplifiers" -" currently not supported" ); + vpbe_dev->amp =NULL ; +v4l2_warn (&vpbe_dev->v4l2_dev, +"non-i2c amplifiers currently not supported" ); } }else { vpbe_dev->amp =NULL ;
@@ -832,8 +832,8 @@ static int vpbe_probe(struct platform_device *pdev)if (!cfg->module_name[0 ] || !cfg->osd.module_name[0 ] || !cfg->venc.module_name[0 ]) { -v4l2_err (pdev->dev.driver,"vpbe display module names not" -" defined\n" ); +v4l2_err (pdev->dev.driver, +"vpbe display module names not defined\n" );return ret; }
Signature · 1 line
2.10.1
PATCH 5/34 DaVinci-VPBE: Return an error code only as a constant in vpbe_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Tue, 11 Oct 2016 13:43:25 +0200
* Return an error code without storing it in an intermediate variable.
* Delete the local variable "ret" which became unnecessary with this refactoring.
--- drivers/media/platform/davinci/vpbe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/davinci/vpbe.c +1 -2
@@ -821,7 +821,6 @@ static int vpbe_probe(struct platform_device *pdev) {struct vpbe_device *vpbe_dev;struct vpbe_config *cfg; -int ret = -EINVAL ;if (!pdev->dev.platform_data) {v4l2_err (pdev->dev.driver,"No platform data\n" );
@@ -834,7 +833,7 @@ static int vpbe_probe(struct platform_device *pdev) !cfg->venc.module_name[0]) {v4l2_err (pdev->dev.driver,"vpbe display module names not defined\n" ); -return ret; +return -EINVAL ; } vpbe_dev =kzalloc (sizeof (*vpbe_dev),GFP_KERNEL );
Signature · 1 line
2.10.1
PATCH 6/34 DaVinci-VPBE: Return an error code only by a single variable in vpbe_initialize()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Tue, 11 Oct 2016 14:15:57 +0200
An error code was assigned to the local variable "err" in an if branch. But this variable was not used further then.
Use the local variable "ret" instead like at other places in this function.
VPBE display driver")
--- drivers/media/platform/davinci/vpbe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpbe.c +1 -1
@@ -665,7 +665,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)if (err) {v4l2_err (&vpbe_dev->v4l2_dev,"unable to initialize the OSD device" ); - err = -ENOMEM ; + ret = -ENOMEM ; goto fail_dev_unregister; } }
Signature · 1 line
2.10.1
Re: [PATCH 06/34] [media] DaVinci-VPBE: Return an error code only by a single variable in vpbe_initialize()
Em Wed, 12 Oct 2016 16:40:22 +0200
SF Markus Elfring <[email protected]> escreveu:
Quoted 20 lines
From: Markus Elfring <[email protected]>
Date: Tue, 11 Oct 2016 14:15:57 +0200An error code was assigned to the local variable "err" in an if branch. But this variable was not used further then.
Use the local variable "ret" instead like at other places in this function.
Fixes 66715cdc3224a4e241c1a92856b9a4af3b70e06d ("[media] davinci vpbe:VPBE display driver")
Signed-off-by Markus Elfring <[email protected]>--- drivers/media/platform/davinci/vpbe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/davinci/vpbe.c +0
-0
drivers/media/platform/davinci/vpbe.c static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) · line 671
Quoted 8 lines
drivers/media/platform/davinci/vpbe.c +1
-1@@ -665,7 +665,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)if (err) {v4l2_err (&vpbe_dev->v4l2_dev,"unable to initialize the OSD device" ); - err = -ENOMEM ; + ret = -ENOMEM ; goto fail_dev_unregister; } }
Hmm... why are you keeping both "err" and "ret" variables here? Just one var is needed. Also, why not just return the error code?
If you want to cleanup the code, please look at the entire function, and not to just this occurrence.
I mean, IMHO, this code (and all similar occurrences), should be, instead:
ret = osd_device->ops.initialize(osd_device);
if (ret) {
v4l2_err(&vpbe_dev->v4l2_dev,
"unable to initialize the OSD device");
goto fail_dev_unregister;
}and the "err" var can probably be removed.
Thanks,
Mauro
PATCH 7/34 DaVinci-VPBE: Delete an unnecessary variable initialisation in vpbe_initialize()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 09:45:39 +0200
The local variable "ret" will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
--- drivers/media/platform/davinci/vpbe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpbe.c +1 -1
@@ -597,7 +597,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)struct osd_state *osd_device;struct i2c_adapter *i2c_adap;int num_encoders; -int ret =0 ; +int ret;int err;int i;
Signature · 1 line
2.10.1
Re: [PATCH 07/34] [media] DaVinci-VPBE: Delete an unnecessary variable initialisation in vpbe_initialize()
Em Wed, 12 Oct 2016 16:42:31 +0200
SF Markus Elfring <[email protected]> escreveu:
Quoted 16 lines
From: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 09:45:39 +0200The local variable "ret" will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
Signed-off-by Markus Elfring <[email protected]>--- drivers/media/platform/davinci/vpbe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/davinci/vpbe.c +0
-0
drivers/media/platform/davinci/vpbe.c static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) · line 601
Quoted 6 lines
drivers/media/platform/davinci/vpbe.c +1
-1@@ -597,7 +597,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)struct osd_state *osd_device;struct i2c_adapter *i2c_adap;int num_encoders; -int ret =0 ; +int ret;int err;
Please fold this change to the patch where you'll be addressing the issues with "err" var, as per my previous email.
Thanks,
Mauro
PATCH 8/34 DaVinci-VPBE: Return the success indication only as a constant in vpbe_set_mode()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 09:51:29 +0200
* Return a success code without storing it in an intermediate variable.
* Delete the local variable "ret" which became unnecessary with this refactoring.
--- drivers/media/platform/davinci/vpbe.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/davinci/vpbe.c +1 -3
@@ -509,7 +509,6 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev,struct v4l2_dv_timings dv_timings;struct osd_state *osd_device;int out_index = vpbe_dev->current_out_index; -int ret =0 ;int i;if (!mode_info || !mode_info->name)
@@ -549,8 +548,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev, vpbe_dev->current_timings.upper_margin);mutex_unlock (&vpbe_dev->lock); - -return ret; +return 0 ; }static int vpbe_set_default_mode (struct vpbe_device *vpbe_dev)
Signature · 1 line
2.10.1
PATCH 9/34 DaVinci-VPBE: Reduce the scope for a variable in vpbe_set_default_output()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 09:54:26 +0200
* Move the definition for the variable "ret" into an if branch so that an extra initialisation can be avoided at the beginning by this refactoring.
* Return a success code as a constant at the end.
--- drivers/media/platform/davinci/vpbe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/davinci/vpbe.c +3 -3
@@ -297,19 +297,19 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index)static int vpbe_set_default_output (struct vpbe_device *vpbe_dev) {struct vpbe_config *cfg = vpbe_dev->cfg; -int ret =0 ;int i;for (i =0 ; i < cfg->num_outputs; i++) {if (!strcmp (def_output, cfg->outputs[i].output.name)) { - ret =vpbe_set_output (vpbe_dev, i); +int ret =vpbe_set_output (vpbe_dev, i); +if (!ret) vpbe_dev->current_out_index = i;return ret; } } -return ret; +return 0 ; }/**
Signature · 1 line
2.10.1
PATCH 10/34 DaVinci-VPBE: Check return value of a setup_if_config() call in vpbe_set_output()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 09:56:56 +0200
* A function was called over the pointer "setup_if_config" in the data structure "venc_platform_data". But the return value was not used so far. Thus assign it to the local variable "ret" which will be checked with the next statement.
* Pass a value to this function call without storing it in an intermediate variable before.
* Delete the local variable "if_params" which became unnecessary with this refactoring.
--- drivers/media/platform/davinci/vpbe.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/media/platform/davinci/vpbe.c +2 -3
@@ -227,7 +227,6 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index)vpbe_current_encoder_info (vpbe_dev);struct vpbe_config *cfg = vpbe_dev->cfg;struct venc_platform_data *venc_device = vpbe_dev->venc_device; -u32 if_params;int enc_out_index;int sd_index;int ret =0 ;
@@ -257,8 +256,8 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) goto out; } - if_params = cfg->outputs[index].if_params; - venc_device->setup_if_config (if_params); + ret = venc_device->setup_if_config (cfg + ->outputs[index].if_params);if (ret) goto out; }
Signature · 1 line
2.10.1
Re: [PATCH 10/34] [media] DaVinci-VPBE: Check return value of a setup_if_config() call in vpbe_set_output()
Quoted 34 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 09:56:56 +0200* A function was called over the pointer "
setup_if_config" in the data structure "venc_platform_data". But the return value was not used so far. Thus assign it to the local variable "ret" which will be checked with the next statement.Fixes 9a7f95ad1c946efdd7a7a72df27db738260a0fd8 ("[media] davinci vpbe: add dm365 VPBE display driver changes")* Pass a value to this function call without storing it in an intermediate variable before.
* Delete the local variable "
if_params" which became unnecessary with this refactoring.Signed-off-by Markus Elfring <[email protected]>--- drivers/media/platform/davinci/vpbe.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/media/platform/davinci/vpbe.c +0
-1@@ -227,7 +227,6 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index)vpbe_current_encoder_info (vpbe_dev);struct vpbe_config *cfg = vpbe_dev->cfg;struct venc_platform_data *venc_device = vpbe_dev->venc_device; -u32 if_params;int enc_out_index;int sd_index;int ret =0 ;
drivers/media/platform/davinci/vpbe.c static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) · line 260
Quoted 7 lines
drivers/media/platform/davinci/vpbe.c +2
-2@@ -257,8 +256,8 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) goto out; } - if_params = cfg->outputs[index].if_params; - venc_device->setup_if_config (if_params); + ret = venc_device->setup_if_config (cfg + ->outputs[index].if_params);
Either keep this as one line or keep the if_params temp variable. This odd linebreak
is ugly.
Regards,
Hans
Quoted 4 lines
drivers/media/platform/davinci/vpbe.c +0
-0if (ret) goto out; }
Re: [PATCH 10/34] [media] DaVinci-VPBE: Check return value of a setup_if_config() call in vpbe_set_output()
Quoted 37 lines
Quoted 37 lines
From: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 09:56:56 +0200* A function was called over the pointer "
setup_if_config" in the data structure "venc_platform_data". But the return value was not used so far. Thus assign it to the local variable "ret" which will be checked with the next statement.Fixes 9a7f95ad1c946efdd7a7a72df27db738260a0fd8 ("[media] davinci vpbe: add dm365 VPBE display driver changes")* Pass a value to this function call without storing it in an intermediate variable before.
* Delete the local variable "
if_params" which became unnecessary with this refactoring.Signed-off-by Markus Elfring <[email protected]>--- drivers/media/platform/davinci/vpbe.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/media/platform/davinci/vpbe.c +0
-1@@ -227,7 +227,6 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index)vpbe_current_encoder_info (vpbe_dev);struct vpbe_config *cfg = vpbe_dev->cfg;struct venc_platform_data *venc_device = vpbe_dev->venc_device; -u32 if_params;int enc_out_index;int sd_index;int ret =0 ;@@ -257,8 +256,8 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) goto out; }
Quoted 6 lines
drivers/media/platform/davinci/vpbe.c static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) · line 260
Quoted 4 lines
drivers/media/platform/davinci/vpbe.c +2
-2- if_params = cfg->outputs[index].if_params; - venc_device->setup_if_config (if_params); + ret = venc_device->setup_if_config (cfg + ->outputs[index].if_params);Either keep this as one line
Will you tolerate a line length of 82 characters then?
Quoted 1 line
or keep the
if_paramstemp variable.
My proposal was to get rid of it.
Quoted 1 line
This odd linebreak is ugly.
I am curious on how the desired changes can be integrated after a couple of update suggestions were accepted from this patch series.
Regards,
Markus
Re: [PATCH 10/34] [media] DaVinci-VPBE: Check return value of a setup_if_config() call in vpbe_set_output()
Quoted 37 lines · SF Markus Elfring
Quoted 37 lines
Quoted 37 lines
From: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 09:56:56 +0200* A function was called over the pointer "
setup_if_config" in the data structure "venc_platform_data". But the return value was not used so far. Thus assign it to the local variable "ret" which will be checked with the next statement.Fixes 9a7f95ad1c946efdd7a7a72df27db738260a0fd8 ("[media] davinci vpbe: add dm365 VPBE display driver changes")* Pass a value to this function call without storing it in an intermediate variable before.
* Delete the local variable "
if_params" which became unnecessary with this refactoring.Signed-off-by Markus Elfring <[email protected]>--- drivers/media/platform/davinci/vpbe.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/media/platform/davinci/vpbe.c +0
-1@@ -227,7 +227,6 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index)vpbe_current_encoder_info (vpbe_dev);struct vpbe_config *cfg = vpbe_dev->cfg;struct venc_platform_data *venc_device = vpbe_dev->venc_device; -u32 if_params;int enc_out_index;int sd_index;int ret =0 ;@@ -257,8 +256,8 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) goto out; }
Quoted 8 lines
Quoted 6 lines
drivers/media/platform/davinci/vpbe.c static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) · line 260
Quoted 4 lines
drivers/media/platform/davinci/vpbe.c +2
-2- if_params = cfg->outputs[index].if_params; - venc_device->setup_if_config (if_params); + ret = venc_device->setup_if_config (cfg + ->outputs[index].if_params);Either keep this as one line
Will you tolerate a line length of 82 characters then?
Yes, if it improves readability, which it does.
Quoted 11 lines
Quoted 3 lines
or keep the
if_paramstemp variable.My proposal was to get rid of it.
Quoted 1 line
This odd linebreak is ugly.
I am curious on how the desired changes can be integrated after a couple of update suggestions were accepted from this patch series.
See my previous reply to 17/34.
Regards,
Hans
PATCH v2 10/34 DaVinci-VPBE: Check return value of a setup_if_config() call in vpbe_set_output()
From: Markus Elfring <[email protected]>
Date: Sun, 6 Nov 2016 20:40:20 +0100
* A function was called over the pointer "setup_if_config" in the data structure "venc_platform_data". But the return value was not used so far. Thus assign it to the local variable "ret" which will be checked with the next statement.
* Pass a value to this function call without storing it in an intermediate variable before.
* Delete the local variable "if_params" which became unnecessary with this refactoring.
---
v2: Keep the assignment statement on one line despite of its length
of 82 characters.
drivers/media/platform/davinci/vpbe.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/davinci/vpbe.c +1 -3
@@ -227,7 +227,6 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index)vpbe_current_encoder_info (vpbe_dev);struct vpbe_config *cfg = vpbe_dev->cfg;struct venc_platform_data *venc_device = vpbe_dev->venc_device; -u32 if_params;int enc_out_index;int sd_index;int ret =0 ;
@@ -257,5 +257,4 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) } - if_params = cfg->outputs[index].if_params; - venc_device->setup_if_config (if_params); + ret = venc_device->setup_if_config (cfg->outputs[index].if_params);if (ret)
Signature · 1 line
2.10.2
PATCH 11/34 DaVinci-VPBE: Rename a jump label in vpbe_set_output()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:10:19 +0200
Adjust jump labels according to the Linux coding style convention.
--- drivers/media/platform/davinci/vpbe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/davinci/vpbe.c +4 -4
@@ -253,20 +253,20 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) sd_index =vpbe_find_encoder_sd_index (cfg, index);if (sd_index <0 ) { ret = -EINVAL ; - goto out; + goto unlock; } ret = venc_device->setup_if_config (cfg ->outputs[index].if_params);if (ret) - goto out; + goto unlock; }/* Set output at the encoder */ ret =v4l2_subdev_call (vpbe_dev->encoders[sd_index], video, s_routing,0 , enc_out_index,0 );if (ret) - goto out; + goto unlock;/* * It is assumed that venc or extenal encoder will set a default
@@ -288,7 +288,7 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index) vpbe_dev->current_sd_index = sd_index; vpbe_dev->current_out_index = index; } -out: +unlock:mutex_unlock (&vpbe_dev->lock);return ret; }
Signature · 1 line
2.10.1
PATCH 12/34 DaVinci-VPBE: Delete an unnecessary variable initialisation in vpbe_set_output()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:16:23 +0200
The local variable "ret" will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
--- drivers/media/platform/davinci/vpbe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpbe.c +1 -1
@@ -229,7 +229,7 @@ static int vpbe_set_output(struct vpbe_device *vpbe_dev, int index)struct venc_platform_data *venc_device = vpbe_dev->venc_device;int enc_out_index;int sd_index; -int ret =0 ; +int ret;if (index >= cfg->num_outputs)return -EINVAL ;
Signature · 1 line
2.10.1
PATCH 13/34 DaVinci-VPFE-Capture: Use kmalloc_array() in vpfe_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:20:02 +0200
* A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention.
--- drivers/media/platform/davinci/vpfe_capture.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/platform/davinci/vpfe_capture.c +3 -2
@@ -1940,8 +1940,9 @@ static int vpfe_probe(struct platform_device *pdev)video_set_drvdata (&vpfe_dev->video_dev, vpfe_dev); i2c_adap =i2c_get_adapter (vpfe_cfg->i2c_adapter_id); num_subdevs = vpfe_cfg->num_subdevs; - vpfe_dev->sd =kmalloc (sizeof (struct v4l2_subdev *) * num_subdevs, -GFP_KERNEL ); + vpfe_dev->sd =kmalloc_array (num_subdevs, +sizeof (*vpfe_dev->sd), +GFP_KERNEL ); if (NULL = vpfe_dev->sd) {v4l2_err (&vpfe_dev->v4l2_dev,"unable to allocate memory for subdevice pointers\n" );
Signature · 1 line
2.10.1
PATCH 14/34 DaVinci-VPFE-Capture: Delete three error messages for a failed memory allocation
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:22:47 +0200
The script "checkpatch.pl" pointed information out like the following.
WARNING: Possible unnecessary 'out of memory' message
Thus remove such a logging statement in two functions.
--- drivers/media/platform/davinci/vpfe_capture.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/media/platform/davinci/vpfe_capture.c +3 -10
@@ -512,11 +512,9 @@ static int vpfe_open(struct file *file)/* Allocate memory for the file handle object */ fh =kmalloc (sizeof (struct vpfe_fh ),GFP_KERNEL ); - if (NULL = fh) { -v4l2_err (&vpfe_dev->v4l2_dev, -"unable to allocate memory for file handle object\n" ); +if (!fh)return -ENOMEM ; - } +/* store pointer to fh in private_data member of file */ file->private_data = fh; fh->vpfe_dev = vpfe_dev;
@@ -1853,11 +1851,8 @@ static int vpfe_probe(struct platform_device *pdev)/* Allocate memory for ccdc configuration */ ccdc_cfg =kmalloc (sizeof (struct ccdc_config ),GFP_KERNEL ); - if (NULL = ccdc_cfg) { -v4l2_err (pdev->dev.driver, -"Memory allocation failed for ccdc_cfg\n" ); +if (!ccdc_cfg) goto probe_free_dev_mem; - }mutex_lock (&ccdc_lock);
@@ -1944,8 +1939,6 @@ static int vpfe_probe(struct platform_device *pdev)sizeof (*vpfe_dev->sd), GFP_KERNEL); if (NULL = vpfe_dev->sd) { -v4l2_err (&vpfe_dev->v4l2_dev, -"unable to allocate memory for subdevice pointers\n" ); ret = -ENOMEM ; goto probe_out_video_unregister; }
Signature · 1 line
2.10.1
PATCH 15/34 DaVinci-VPFE-Capture: Improve another size determination in vpfe_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:24:57 +0200
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer.
--- drivers/media/platform/davinci/vpfe_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpfe_capture.c +1 -1
@@ -1850,7 +1850,7 @@ static int vpfe_probe(struct platform_device *pdev) }/* Allocate memory for ccdc configuration */ - ccdc_cfg =kmalloc (sizeof (struct ccdc_config ),GFP_KERNEL ); + ccdc_cfg =kmalloc (sizeof (*ccdc_cfg),GFP_KERNEL );if (!ccdc_cfg) goto probe_free_dev_mem;
Signature · 1 line
2.10.1
PATCH 16/34 DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in vpfe_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:30:28 +0200
* Return an error code as a constant after a failed call of the function "vpfe_initialize".
* The local variable "ret" will be set then to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
--- drivers/media/platform/davinci/vpfe_capture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/davinci/vpfe_capture.c +2 -2
@@ -1819,7 +1819,7 @@ static int vpfe_probe(struct platform_device *pdev)struct vpfe_device *vpfe_dev;struct i2c_adapter *i2c_adap;struct video_device *vfd; -int ret = -ENOMEM , i, j; +int ret, i, j;int num_subdevs =0 ;/* Get the pointer to the device object */
@@ -1828,7 +1828,7 @@ static int vpfe_probe(struct platform_device *pdev)if (!vpfe_dev) {v4l2_err (pdev->dev.driver,"Failed to allocate memory for vpfe_dev\n" ); -return ret; +return -ENOMEM ; } vpfe_dev->pdev = &pdev->dev;
Signature · 1 line
2.10.1
PATCH 17/34 DaVinci-VPFE-Capture: Improve another size determination in vpfe_enum_input()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:33:42 +0200
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer.
--- drivers/media/platform/davinci/vpfe_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpfe_capture.c +1 -1
@@ -1091,7 +1091,7 @@ static int vpfe_enum_input(struct file *file, void *priv,return -EINVAL ; } sdinfo = &vpfe_dev->cfg->sub_devs[subdev]; -memcpy (inp, &sdinfo->inputs[index],sizeof (struct v4l2_input )); +memcpy (inp, &sdinfo->inputs[index],sizeof (*inp));return 0 ; }
Signature · 1 line
2.10.1
Re: [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_enum_input()
Quoted 17 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:33:42 +0200Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer.
Signed-off-by Markus Elfring <[email protected]>--- drivers/media/platform/davinci/vpfe_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/davinci/vpfe_capture.c +0
-0
drivers/media/platform/davinci/vpfe_capture.c static int vpfe_enum_input(struct file *file, void *priv, · line 1094
Quoted 5 lines
drivers/media/platform/davinci/vpfe_capture.c +1
-1@@ -1091,7 +1091,7 @@ static int vpfe_enum_input(struct file *file, void *priv,return -EINVAL ; } sdinfo = &vpfe_dev->cfg->sub_devs[subdev]; -memcpy (inp, &sdinfo->inputs[index],sizeof (struct v4l2_input )); +memcpy (inp, &sdinfo->inputs[index],sizeof (*inp));
If I am not mistaken this can be written as:
*inp = sdinfo->inputs[index];
Much better.
Regards,
Hans
Quoted 4 lines
drivers/media/platform/davinci/vpfe_capture.c +0
-0return 0 ; }
Re: [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_enum_input()
Quoted 9 lines
drivers/media/platform/davinci/vpfe_capture.c static int vpfe_enum_input(struct file *file, void *priv, · line 1094
Quoted 6 lines
drivers/media/platform/davinci/vpfe_capture.c +1
-1@@ -1091,7 +1091,7 @@ static int vpfe_enum_input(struct file *file, void *priv,return -EINVAL ; } sdinfo = &vpfe_dev->cfg->sub_devs[subdev]; -memcpy (inp, &sdinfo->inputs[index],sizeof (struct v4l2_input )); +memcpy (inp, &sdinfo->inputs[index],sizeof (*inp));If I am not mistaken this can be written as:
Quoted 3 lines
*inp = sdinfo->inputs[index];Much better.
At which position would you like to integrate a second approach for such a change from this patch series?
* Do you expect me to send a "V2" for the whole series?
* Will an update step be appropriate if I would rebase it on other recently accepted suggestions?
Regards,
Markus
Re: [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_enum_input()
Quoted 9 lines · SF Markus Elfring
Quoted 9 lines
drivers/media/platform/davinci/vpfe_capture.c static int vpfe_enum_input(struct file *file, void *priv, · line 1094
Quoted 6 lines
drivers/media/platform/davinci/vpfe_capture.c +1
-1@@ -1091,7 +1091,7 @@ static int vpfe_enum_input(struct file *file, void *priv,return -EINVAL ; } sdinfo = &vpfe_dev->cfg->sub_devs[subdev]; -memcpy (inp, &sdinfo->inputs[index],sizeof (struct v4l2_input )); +memcpy (inp, &sdinfo->inputs[index],sizeof (*inp));If I am not mistaken this can be written as:
Quoted 8 lines
Quoted 3 lines
*inp = sdinfo->inputs[index];Much better.
At which position would you like to integrate a second approach for such a change from this patch series?
* Do you expect me to send a "V2" for the whole series?
No, just for the patches I commented upon.
Quoted 3 lines
* Will an update step be appropriate if I would rebase it on other recently accepted suggestions?
You can base it on
https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=for-v4.10a
That branch has all your other patches of this series merged and is part of a pull
request I posted yesterday.
Hans
Quoted 4 lines
Regards,
Markus
PATCH v2 17/34 DaVinci-VPFE-Capture: Replace a memcpy() call by an assignment in vpfe_enum_input()
From: Markus Elfring <[email protected]>
Date: Sun, 6 Nov 2016 21:54:38 +0100
Use a direct assignment for an array element which can be set over the pointer variable "inp" instead of calling the function "memcpy" here.
--- drivers/media/platform/davinci/vpfe_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpfe_capture.c +1 -1
@@ -1091,7 +1091,7 @@ static int vpfe_enum_input(struct file *file, void *priv,return -EINVAL ; } sdinfo = &vpfe_dev->cfg->sub_devs[subdev]; -memcpy (inp, &sdinfo->inputs[index],sizeof (struct v4l2_input )); + *inp = sdinfo->inputs[index];return 0 ; }
Signature · 1 line
2.10.2
PATCH 18/34 DaVinci-VPFE-Capture: Combine substrings for an error message in vpfe_enum_input()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:40:10 +0200
The script "checkpatch.pl" pointed information out like the following.
WARNING: quoted string split across lines
Thus fix an affected source code place.
--- drivers/media/platform/davinci/vpfe_capture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/davinci/vpfe_capture.c +2 -2
@@ -1086,8 +1086,8 @@ static int vpfe_enum_input(struct file *file, void *priv, &subdev, &index, inp->index) < 0) { -v4l2_err (&vpfe_dev->v4l2_dev,"input information not found" -" for the subdev\n" ); +v4l2_err (&vpfe_dev->v4l2_dev, +"input information not found for the subdev\n" );return -EINVAL ; } sdinfo = &vpfe_dev->cfg->sub_devs[subdev];
Signature · 1 line
2.10.1
PATCH 19/34 DaVinci-VPFE-Capture: Improve another size determination in vpfe_open()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:44:05 +0200
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer.
--- drivers/media/platform/davinci/vpfe_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpfe_capture.c +1 -1
@@ -511,7 +511,7 @@ static int vpfe_open(struct file *file) }/* Allocate memory for the file handle object */ - fh =kmalloc (sizeof (struct vpfe_fh ),GFP_KERNEL ); + fh =kmalloc (sizeof (*fh),GFP_KERNEL );if (!fh)return -ENOMEM ;
Signature · 1 line
2.10.1
PATCH 20/34 DaVinci-VPFE-Capture: Adjust 13 checks for null pointers
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:46:28 +0200
Convert comparisons with the preprocessor symbol "NULL" to condition checks without it.
--- drivers/media/platform/davinci/vpfe_capture.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/media/platform/davinci/vpfe_capture.c +11 -14
@@ -229,7 +229,7 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)BUG_ON (!dev->hw_ops.getfid);mutex_lock (&ccdc_lock); - if (NULL = ccdc_cfg) { +if (!ccdc_cfg) {/* * TODO. Will this ever happen? if so, we need to fix it. * Proabably we need to add the request to a linked list and
@@ -265,7 +265,7 @@ EXPORT_SYMBOL(vpfe_register_ccdc_device);*/ void vpfe_unregister_ccdc_device (struct ccdc_hw_device *dev) { - if (NULL = dev) { +if (!dev) {printk (KERN_ERR "invalid ccdc device ptr\n" );return ; }
@@ -469,7 +469,7 @@ static int vpfe_initialize_device(struct vpfe_device *vpfe_dev)/* now open the ccdc device to initialize it */ mutex_lock (&ccdc_lock); - if (NULL = ccdc_dev) { +if (!ccdc_dev) {v4l2_err (&vpfe_dev->v4l2_dev,"ccdc device not registered\n" ); ret = -ENODEV ; goto unlock;
@@ -582,7 +582,7 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id) goto clear_intr;/* only for 6446 this will be applicable */ -if (NULL != ccdc_dev->hw_ops.reset) +if (ccdc_dev->hw_ops.reset) ccdc_dev->hw_ops.reset ();if (field =V4L2_FIELD_NONE ) {
@@ -822,7 +822,7 @@ static const struct vpfe_pixel_format *int temp, found; vpfe_pix_fmt =vpfe_lookup_pix_format (pixfmt->pixelformat); - if (NULL = vpfe_pix_fmt) { +if (!vpfe_pix_fmt) {/* * use current pixel format in the vpfe device. We * will find this pix format in the table
@@ -965,7 +965,7 @@ static int vpfe_enum_fmt_vid_cap(struct file *file, void *priv,/* Fill in the information about format */ pix_fmt =vpfe_lookup_pix_format (pix); -if (NULL != pix_fmt) { +if (pix_fmt) { temp_index = fmt->index; *fmt = pix_fmt->fmtdesc; fmt->index = temp_index;
@@ -991,8 +991,7 @@ static int vpfe_s_fmt_vid_cap(struct file *file, void *priv,/* Check for valid frame format */ pix_fmts =vpfe_check_format (vpfe_dev, &fmt->fmt.pix); - - if (NULL = pix_fmts) +if (!pix_fmts)return -EINVAL ;/* store the pixel format in the device object */
@@ -1018,7 +1017,7 @@ static int vpfe_try_fmt_vid_cap(struct file *file, void *priv,v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev,"vpfe_try_fmt_vid_cap\n" ); pix_fmts =vpfe_check_format (vpfe_dev, &f->fmt.pix); - if (NULL = pix_fmts) +if (!pix_fmts)return -EINVAL ;return 0 ; }
@@ -1833,7 +1832,7 @@ static int vpfe_probe(struct platform_device *pdev) vpfe_dev->pdev = &pdev->dev; - if (NULL = pdev->dev.platform_data) { +if (!pdev->dev.platform_data) {v4l2_err (pdev->dev.driver,"Unable to get vpfe config\n" ); ret = -ENODEV ; goto probe_free_dev_mem;
@@ -1841,9 +1840,7 @@ static int vpfe_probe(struct platform_device *pdev) vpfe_cfg = pdev->dev.platform_data; vpfe_dev->cfg = vpfe_cfg; - if (NULL = vpfe_cfg->ccdc || - NULL = vpfe_cfg->card_name || - NULL = vpfe_cfg->sub_devs) { +if (!vpfe_cfg->ccdc || !vpfe_cfg->card_name || !vpfe_cfg->sub_devs) {v4l2_err (pdev->dev.driver,"null ptr in vpfe_cfg\n" ); ret = -ENOENT ; goto probe_free_dev_mem;
@@ -1938,7 +1935,7 @@ static int vpfe_probe(struct platform_device *pdev) vpfe_dev->sd =kmalloc_array (num_subdevs,sizeof (*vpfe_dev->sd),GFP_KERNEL ); - if (NULL = vpfe_dev->sd) { +if (!vpfe_dev->sd) { ret = -ENOMEM ; goto probe_out_video_unregister; }
Signature · 1 line
2.10.1
PATCH 21/34 DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in 11 functions
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 10:50:54 +0200
The local variable "ret" will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
--- drivers/media/platform/davinci/vpfe_capture.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/media/platform/davinci/vpfe_capture.c +11 -11
@@ -384,7 +384,7 @@ static int vpfe_config_image_format(struct vpfe_device *vpfe_dev, };struct v4l2_mbus_framefmt *mbus_fmt = &fmt.format;struct v4l2_pix_format *pix = &vpfe_dev->fmt.fmt.pix; -int i, ret =0 ; +int i, ret;for (i =0 ; i <ARRAY_SIZE (vpfe_standards); i++) {if (vpfe_standards[i].std_id & std_id) {
@@ -453,7 +453,7 @@ static int vpfe_config_image_format(struct vpfe_device *vpfe_dev,static int vpfe_initialize_device (struct vpfe_device *vpfe_dev) { -int ret =0 ; +int ret;/* set first input of current subdevice as the current input */ vpfe_dev->current_input =0 ;
@@ -979,7 +979,7 @@ static int vpfe_s_fmt_vid_cap(struct file *file, void *priv, {struct vpfe_device *vpfe_dev =video_drvdata (file);const struct vpfe_pixel_format *pix_fmts; -int ret =0 ; +int ret;v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev,"vpfe_s_fmt_vid_cap\n" );
@@ -1112,7 +1112,7 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index)int subdev_index, inp_index;struct vpfe_route *route;u32 input =0 , output =0 ; -int ret = -EINVAL ; +int ret;v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev,"vpfe_s_input\n" );
@@ -1178,7 +1178,7 @@ static int vpfe_querystd(struct file *file, void *priv, v4l2_std_id *std_id) {struct vpfe_device *vpfe_dev =video_drvdata (file);struct vpfe_subdev_info *sdinfo; -int ret =0 ; +int ret;v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev,"vpfe_querystd\n" );
@@ -1197,7 +1197,7 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id) {struct vpfe_device *vpfe_dev =video_drvdata (file);struct vpfe_subdev_info *sdinfo; -int ret =0 ; +int ret;v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev,"vpfe_s_std\n" );
@@ -1346,7 +1346,7 @@ static int vpfe_reqbufs(struct file *file, void *priv, {struct vpfe_device *vpfe_dev =video_drvdata (file);struct vpfe_fh *fh = file->private_data; -int ret =0 ; +int ret;v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev,"vpfe_reqbufs\n" );
@@ -1478,7 +1478,7 @@ static int vpfe_streamon(struct file *file, void *priv,struct vpfe_fh *fh = file->private_data;struct vpfe_subdev_info *sdinfo;unsigned long addr; -int ret =0 ; +int ret;v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev,"vpfe_streamon\n" );
@@ -1561,7 +1561,7 @@ static int vpfe_streamoff(struct file *file, void *priv,struct vpfe_device *vpfe_dev =video_drvdata (file);struct vpfe_fh *fh = file->private_data;struct vpfe_subdev_info *sdinfo; -int ret =0 ; +int ret;v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev,"vpfe_streamoff\n" );
@@ -1647,7 +1647,7 @@ static int vpfe_s_selection(struct file *file, void *priv, {struct vpfe_device *vpfe_dev =video_drvdata (file);struct v4l2_rect rect = sel->r; -int ret =0 ; +int ret;v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev,"vpfe_s_selection\n" );
@@ -1705,7 +1705,7 @@ static long vpfe_param_handler(struct file *file, void *priv, bool valid_prio, unsigned int cmd, void *param) { struct vpfe_device *vpfe_dev = video_drvdata(file); -int ret =0 ; +int ret;v4l2_dbg (2 , debug, &vpfe_dev->v4l2_dev,"vpfe_param_handler\n" );
Signature · 1 line
2.10.1
PATCH 22/34 DaVinci-VPFE-Capture: Move two assignments in vpfe_s_input()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 11:22:23 +0200
Move assignments for two local variables into an else branch so that their setting will only be performed after corresponding data processing succeeded by this function.
--- drivers/media/platform/davinci/vpfe_capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/platform/davinci/vpfe_capture.c +4 -1
@@ -1111,7 +1111,7 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index)struct vpfe_subdev_info *sdinfo;int subdev_index, inp_index;struct vpfe_route *route; -u32 input =0 , output =0 ; +u32 input, output;int ret;v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev,"vpfe_s_input\n" );
@@ -1144,6 +1144,9 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index)if (route && sdinfo->can_route) { input = route->input; output = route->output; + }else { + input =0 ; + output =0 ; }if (sd)
Signature · 1 line
2.10.1
PATCH 23/34 DaVinci-VPFE-Capture: Delete unnecessary braces in vpfe_isr()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 14:54:21 +0200
Do not use curly brackets at one source code place where a single statement should be sufficient.
--- drivers/media/platform/davinci/vpfe_capture.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/davinci/vpfe_capture.c +1 -2
@@ -615,9 +615,8 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id)* interleavely or separately in memory, reconfigure * the CCDC memory address */ -if (field =V4L2_FIELD_SEQ_TB ) { +if (field =V4L2_FIELD_SEQ_TB )vpfe_schedule_bottom_field (vpfe_dev); - } goto clear_intr; }/*
Signature · 1 line
2.10.1
PATCH 24/34 DaVinci-VPFE-Capture: Delete an unnecessary return statement in vpfe_unregister_ccdc_device()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:10:54 +0200
The script "checkpatch.pl" pointed information out like the following.
WARNING: void function return statements are not generally useful
Thus remove such a statement here.
--- drivers/media/platform/davinci/vpfe_capture.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/platform/davinci/vpfe_capture.c +0 -1
@@ -281,7 +281,6 @@ void vpfe_unregister_ccdc_device(struct ccdc_hw_device *dev)mutex_lock (&ccdc_lock); ccdc_dev =NULL ;mutex_unlock (&ccdc_lock); -return ; }EXPORT_SYMBOL (vpfe_unregister_ccdc_device);
Signature · 1 line
2.10.1
PATCH 25/34 DaVinci-VPIF-Capture: Use kcalloc() in vpif_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:15:34 +0200
* A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention.
--- drivers/media/platform/davinci/vpif_capture.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/davinci/vpif_capture.c +1 -2
@@ -1464,8 +1464,7 @@ static __init int vpif_probe(struct platform_device *pdev) vpif_obj.config = pdev->dev.platform_data; subdev_count = vpif_obj.config->subdev_count; - vpif_obj.sd =kzalloc (sizeof (struct v4l2_subdev *) * subdev_count, -GFP_KERNEL ); + vpif_obj.sd =kcalloc (subdev_count,sizeof (*vpif_obj.sd),GFP_KERNEL );if (vpif_obj.sd =NULL ) {vpif_err ("unable to allocate memory for subdevice pointers\n" ); err = -ENOMEM ;
Signature · 1 line
2.10.1
PATCH 26/34 DaVinci-VPIF-Capture: Delete an error message for a failed memory allocation
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:18:45 +0200
Omit an extra message for a memory allocation failure in this function.
--- drivers/media/platform/davinci/vpif_capture.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/platform/davinci/vpif_capture.c +0 -1
@@ -1466,7 +1466,6 @@ static __init int vpif_probe(struct platform_device *pdev) subdev_count = vpif_obj.config->subdev_count; vpif_obj.sd =kcalloc (subdev_count,sizeof (*vpif_obj.sd),GFP_KERNEL );if (vpif_obj.sd =NULL ) { -vpif_err ("unable to allocate memory for subdevice pointers\n" ); err = -ENOMEM ; goto vpif_unregister; }
Signature · 1 line
2.10.1
PATCH 28/34 DaVinci-VPIF-Capture: Delete an unnecessary variable initialisation in vpif_querystd()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:22:45 +0200
The local variable "ret" will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
--- drivers/media/platform/davinci/vpif_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpif_capture.c +1 -1
@@ -731,7 +731,7 @@ static int vpif_querystd(struct file *file, void *priv, v4l2_std_id *std_id) {struct video_device *vdev =video_devdata (file);struct channel_obj *ch =video_get_drvdata (vdev); -int ret =0 ; +int ret;vpif_dbg (2 , debug,"vpif_querystd\n" );
Signature · 1 line
2.10.1
PATCH 29/34 DaVinci-VPIF-Capture: Delete an unnecessary variable initialisation in vpif_channel_isr()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:25:08 +0200
The local variable "channel_id" will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
--- drivers/media/platform/davinci/vpif_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpif_capture.c +1 -1
@@ -375,7 +375,7 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)struct vpif_device *dev = &vpif_obj;struct common_obj *common;struct channel_obj *ch; -int channel_id =0 ; +int channel_id;int fid =-1 , i; channel_id = *(int *)(dev_id);
Signature · 1 line
2.10.1
PATCH 30/34 DaVinci-VPIF-Display: Use kcalloc() in vpif_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:30:44 +0200
* A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention.
--- drivers/media/platform/davinci/vpif_display.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/davinci/vpif_display.c +1 -2
@@ -1279,8 +1279,7 @@ static __init int vpif_probe(struct platform_device *pdev) vpif_obj.config = pdev->dev.platform_data; subdev_count = vpif_obj.config->subdev_count; subdevdata = vpif_obj.config->subdevinfo; - vpif_obj.sd =kzalloc (sizeof (struct v4l2_subdev *) * subdev_count, -GFP_KERNEL ); + vpif_obj.sd =kcalloc (subdev_count,sizeof (*vpif_obj.sd),GFP_KERNEL );if (vpif_obj.sd =NULL ) {vpif_err ("unable to allocate memory for subdevice pointers\n" ); err = -ENOMEM ;
Signature · 1 line
2.10.1
PATCH 31/34 DaVinci-VPIF-Display: Delete an error message for a failed memory allocation
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:38:41 +0200
Omit an extra message for a memory allocation failure in this function.
--- drivers/media/platform/davinci/vpif_display.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/platform/davinci/vpif_display.c +0 -1
@@ -1281,7 +1281,6 @@ static __init int vpif_probe(struct platform_device *pdev) subdevdata = vpif_obj.config->subdevinfo; vpif_obj.sd =kcalloc (subdev_count,sizeof (*vpif_obj.sd),GFP_KERNEL );if (vpif_obj.sd =NULL ) { -vpif_err ("unable to allocate memory for subdevice pointers\n" ); err = -ENOMEM ; goto vpif_unregister; }
Signature · 1 line
2.10.1
PATCH 32/34 DaVinci-VPIF-Display: Adjust 11 checks for null pointers
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:40:32 +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.
--- drivers/media/platform/davinci/vpif_display.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/media/platform/davinci/vpif_display.c +11 -11
@@ -271,10 +271,10 @@ static void vpif_stop_streaming(struct vb2_queue *vq)vb2_buffer_done (&common->cur_frm->vb.vb2_buf,VB2_BUF_STATE_ERROR ); }else { -if (common->cur_frm !=NULL ) +if (common->cur_frm)vb2_buffer_done (&common->cur_frm->vb.vb2_buf,VB2_BUF_STATE_ERROR ); -if (common->next_frm !=NULL ) +if (common->next_frm)vb2_buffer_done (&common->next_frm->vb.vb2_buf,VB2_BUF_STATE_ERROR ); }
@@ -686,7 +686,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)struct v4l2_output output;int ret; -if (config->chan_config[ch->channel_id].outputs =NULL ) +if (!config->chan_config[ch->channel_id].outputs)return -ENODATA ; chan_cfg = &config->chan_config[ch->channel_id];
@@ -732,7 +732,7 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)struct vpif_display_chan_config *chan_cfg;struct v4l2_output output; -if (config->chan_config[ch->channel_id].outputs =NULL ) +if (!config->chan_config[ch->channel_id].outputs)return -ENODATA ; chan_cfg = &config->chan_config[ch->channel_id];
@@ -783,11 +783,11 @@ vpif_output_to_subdev(struct vpif_display_config *vpif_cfg,vpif_dbg (2 , debug,"vpif_output_to_subdev\n" ); -if (chan_cfg->outputs =NULL ) +if (!chan_cfg->outputs)return -1 ; subdev_name = chan_cfg->outputs[index].subdev_name; -if (subdev_name =NULL ) +if (!subdev_name)return -1 ;/* loop through the sub device list to get the sub device info */
@@ -833,7 +833,7 @@ static int vpif_set_output(struct vpif_display_config *vpif_cfg, } ch->output_idx = index; ch->sd = sd; -if (chan_cfg->outputs !=NULL ) +if (chan_cfg->outputs)/* update tvnorms from the sub device output info */ ch->video_dev.tvnorms = chan_cfg->outputs[index].output.std;return 0 ;
@@ -885,7 +885,7 @@ vpif_enum_dv_timings(struct file *file, void *priv,struct v4l2_output output;int ret; -if (config->chan_config[ch->channel_id].outputs =NULL ) +if (!config->chan_config[ch->channel_id].outputs)return -ENODATA ; chan_cfg = &config->chan_config[ch->channel_id];
@@ -922,7 +922,7 @@ static int vpif_s_dv_timings(struct file *file, void *priv,struct v4l2_output output;int ret; -if (config->chan_config[ch->channel_id].outputs =NULL ) +if (!config->chan_config[ch->channel_id].outputs)return -ENODATA ; chan_cfg = &config->chan_config[ch->channel_id];
@@ -1021,7 +1021,7 @@ static int vpif_g_dv_timings(struct file *file, void *priv,struct video_obj *vid_ch = &ch->video;struct v4l2_output output; -if (config->chan_config[ch->channel_id].outputs =NULL ) +if (!config->chan_config[ch->channel_id].outputs) goto error; chan_cfg = &config->chan_config[ch->channel_id];
@@ -1280,7 +1280,7 @@ static __init int vpif_probe(struct platform_device *pdev) subdev_count = vpif_obj.config->subdev_count; subdevdata = vpif_obj.config->subdevinfo; vpif_obj.sd =kcalloc (subdev_count,sizeof (*vpif_obj.sd),GFP_KERNEL ); -if (vpif_obj.sd =NULL ) { +if (!vpif_obj.sd) { err = -ENOMEM ; goto vpif_unregister; }
Signature · 6 lines
2.10.1 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 33/34 DaVinci-VPIF-Display: Delete an unnecessary variable initialisation in vpif_channel_isr()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:43:12 +0200
The local variable "channel_id" will be reassigned with the following statement at the beginning. Thus omit the explicit initialisation.
--- drivers/media/platform/davinci/vpif_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpif_display.c +1 -1
@@ -363,7 +363,7 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)struct channel_obj *ch;struct common_obj *common;int fid =-1 , i; -int channel_id =0 ; +int channel_id; channel_id = *(int *)(dev_id);if (!vpif_intr_status (channel_id +2 ))
Signature · 1 line
2.10.1
PATCH 34/34 DaVinci-VPIF-Display: Delete an unnecessary variable initialisation in process_progressive_mode()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:45:03 +0200
The local variable "addr" will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.
--- drivers/media/platform/davinci/vpif_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/davinci/vpif_display.c +1 -1
@@ -301,7 +301,7 @@ static struct vb2_ops video_qops = {static void process_progressive_mode (struct common_obj *common) { -unsigned long addr =0 ; +unsigned long addr;spin_lock (&common->irqlock);/* Get the next buffer from buffer queue */
Signature · 1 line
2.10.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 3/34 DaVinci-VPBE: Adjust 16 checks for null pointers
From: Markus Elfring <[email protected]>
Date: Tue, 11 Oct 2016 13:37:10 +0200
The script "checkpatch.pl" pointed information out like the following.
Comparison to NULL could be written ...
Thus fix the affected source code places.
---
Another send try because of the following notification:
Mailer Daemon wrote on 2016-10-12 at 16:39:
Quoted 10 lines
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:
[email protected]:
SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte r texts. BF:<H 0>; S1755378AbcJLOjE
Quoted 7 lines
[email protected]:
SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte r texts. BF:<H 0>; S1755378AbcJLOjE[email protected]:
SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte r texts. BF:<H 0>; S1755378AbcJLOjE
drivers/media/platform/davinci/vpbe.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/media/platform/davinci/vpbe.c +14 -15
@@ -107,7 +107,7 @@ static int vpbe_find_encoder_sd_index(struct vpbe_config *cfg,static int vpbe_g_cropcap (struct vpbe_device *vpbe_dev,struct v4l2_cropcap *cropcap) { - if (NULL = cropcap) +if (!cropcap)return -EINVAL ; cropcap->bounds.left =0 ; cropcap->bounds.top =0 ;
@@ -149,7 +149,7 @@ static int vpbe_get_mode_info(struct vpbe_device *vpbe_dev, char *mode,int curr_output = output_index;int i; - if (NULL = mode) +if (!mode)return -EINVAL ;for (i =0 ; i < cfg->outputs[curr_output].num_modes; i++) {
@@ -166,7 +166,7 @@ static int vpbe_get_mode_info(struct vpbe_device *vpbe_dev, char *mode,static int vpbe_get_current_mode_info (struct vpbe_device *vpbe_dev,struct vpbe_enc_mode_info *mode_info) { - if (NULL = mode_info) +if (!mode_info)return -EINVAL ; *mode_info = vpbe_dev->current_timings;
@@ -356,7 +356,7 @@ static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev, ret =v4l2_subdev_call (vpbe_dev->encoders[sd_index], video, s_dv_timings, dv_timings); -if (!ret && (vpbe_dev->amp !=NULL )) { +if (!ret && vpbe_dev->amp) {/* Call amplifier subdevice */ ret =v4l2_subdev_call (vpbe_dev->amp, video, s_dv_timings, dv_timings);
@@ -512,7 +512,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev,int ret =0 ;int i; - if ((NULL = mode_info) || (NULL = mode_info->name)) +if (!mode_info || !mode_info->name)return -EINVAL ;for (i =0 ; i < cfg->outputs[out_index].num_modes; i++) {
@@ -536,7 +536,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev, }/* Only custom timing should reach here */ -if (preset_mode =NULL ) +if (!preset_mode)return -EINVAL ;mutex_lock (&vpbe_dev->lock);
@@ -570,9 +570,9 @@ static int platform_device_get(struct device *dev, void *data)struct platform_device *pdev =to_platform_device (dev);struct vpbe_device *vpbe_dev = data; -if (strstr (pdev->name,"vpbe-osd" ) !=NULL ) +if (strstr (pdev->name,"vpbe-osd" )) vpbe_dev->osd_device =platform_get_drvdata (pdev); -if (strstr (pdev->name,"vpbe-venc" ) !=NULL ) +if (strstr (pdev->name,"vpbe-venc" )) vpbe_dev->venc_device =dev_get_platdata (&pdev->dev);return 0 ;
@@ -606,7 +606,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)* from the platform device by iteration of platform drivers and * matching with device name */ - if (NULL = vpbe_dev || NULL = dev) { +if (!vpbe_dev || !dev) {printk (KERN_ERR "Null device pointers.\n" );return -ENODEV ; }
@@ -652,7 +652,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) vpbe_dev->venc =venc_sub_dev_init (&vpbe_dev->v4l2_dev, vpbe_dev->cfg->venc.module_name);/* register venc sub device */ -if (vpbe_dev->venc =NULL ) { +if (!vpbe_dev->venc) {v4l2_err (&vpbe_dev->v4l2_dev,"vpbe unable to init venc sub device\n" ); ret = -ENODEV ;
@@ -660,8 +660,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) }/* initialize osd device */ osd_device = vpbe_dev->osd_device; - -if (NULL != osd_device->ops.initialize) { +if (osd_device->ops.initialize) { err = osd_device->ops.initialize (osd_device);if (err) { v4l2_err(&vpbe_dev->v4l2_dev,
@@ -679,7 +678,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) vpbe_dev->encoders =kmalloc_array (num_encoders,sizeof (*vpbe_dev->encoders),GFP_KERNEL ); - if (NULL = vpbe_dev->encoders) { +if (!vpbe_dev->encoders) { ret = -ENOMEM ; goto fail_dev_unregister; }
@@ -715,7 +714,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) }/* Add amplifier subdevice for dm365 */ if ((strcmp (vpbe_dev->cfg->module_name,"dm365-vpbe-display" ) =0 ) && - vpbe_dev->cfg->amp !=NULL ) { + vpbe_dev->cfg->amp) { amp_info = vpbe_dev->cfg->amp;if (amp_info->is_i2c) { vpbe_dev->amp = v4l2_i2c_new_subdev_board(
@@ -824,7 +823,7 @@ static int vpbe_probe(struct platform_device *pdev)struct vpbe_config *cfg;int ret = -EINVAL ; -if (pdev->dev.platform_data =NULL ) { +if (!pdev->dev.platform_data) {v4l2_err (pdev->dev.driver,"No platform data\n" );return -ENODEV ; }
Signature · 1 line
2.10.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 27/34 DaVinci-VPIF-Capture: Adjust ten checks for null pointers
From: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 15:20:34 +0200
The script "checkpatch.pl" pointed information out like the following.
Comparison to NULL could be written ...
Thus fix the affected source code places.
---
Another send try because of the following notification:
Mailer Daemon wrote on 2016-10-12 at 17:06:
Quoted 10 lines
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:
[email protected]:
SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte r texts. BF:<H 0>; S933375AbcJLPGr
Quoted 7 lines
[email protected]:
SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte r texts. BF:<H 0>; S933375AbcJLPGr[email protected]:
SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte r texts. BF:<H 0>; S933375AbcJLPGr
drivers/media/platform/davinci/vpif_capture.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/media/platform/davinci/vpif_capture.c +10 -10
@@ -291,10 +291,10 @@ static void vpif_stop_streaming(struct vb2_queue *vq)vb2_buffer_done (&common->cur_frm->vb.vb2_buf,VB2_BUF_STATE_ERROR ); }else { -if (common->cur_frm !=NULL ) +if (common->cur_frm)vb2_buffer_done (&common->cur_frm->vb.vb2_buf,VB2_BUF_STATE_ERROR ); -if (common->next_frm !=NULL ) +if (common->next_frm)vb2_buffer_done (&common->next_frm->vb.vb2_buf,VB2_BUF_STATE_ERROR ); }
@@ -648,7 +648,7 @@ static int vpif_input_to_subdev(vpif_dbg (2 , debug,"vpif_input_to_subdev\n" ); subdev_name = chan_cfg->inputs[input_index].subdev_name; -if (subdev_name =NULL ) +if (!subdev_name)return -1 ;/* loop through the sub device list to get the sub device info */
@@ -764,7 +764,7 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)vpif_dbg (2 , debug,"vpif_g_std\n" ); -if (config->chan_config[ch->channel_id].inputs =NULL ) +if (!config->chan_config[ch->channel_id].inputs)return -ENODATA ; chan_cfg = &config->chan_config[ch->channel_id];
@@ -794,7 +794,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)vpif_dbg (2 , debug,"vpif_s_std\n" ); -if (config->chan_config[ch->channel_id].inputs =NULL ) +if (!config->chan_config[ch->channel_id].inputs)return -ENODATA ; chan_cfg = &config->chan_config[ch->channel_id];
@@ -1050,7 +1050,7 @@ vpif_enum_dv_timings(struct file *file, void *priv,struct v4l2_input input;int ret; -if (config->chan_config[ch->channel_id].inputs =NULL ) +if (!config->chan_config[ch->channel_id].inputs)return -ENODATA ; chan_cfg = &config->chan_config[ch->channel_id];
@@ -1084,7 +1084,7 @@ vpif_query_dv_timings(struct file *file, void *priv,struct v4l2_input input;int ret; -if (config->chan_config[ch->channel_id].inputs =NULL ) +if (!config->chan_config[ch->channel_id].inputs)return -ENODATA ; chan_cfg = &config->chan_config[ch->channel_id];
@@ -1120,7 +1120,7 @@ static int vpif_s_dv_timings(struct file *file, void *priv,struct v4l2_input input;int ret; -if (config->chan_config[ch->channel_id].inputs =NULL ) +if (!config->chan_config[ch->channel_id].inputs)return -ENODATA ; chan_cfg = &config->chan_config[ch->channel_id];
@@ -1218,7 +1218,7 @@ static int vpif_g_dv_timings(struct file *file, void *priv,struct vpif_capture_chan_config *chan_cfg;struct v4l2_input input; -if (config->chan_config[ch->channel_id].inputs =NULL ) +if (!config->chan_config[ch->channel_id].inputs)return -ENODATA ; chan_cfg = &config->chan_config[ch->channel_id];
@@ -1465,7 +1465,7 @@ static __init int vpif_probe(struct platform_device *pdev) subdev_count = vpif_obj.config->subdev_count; vpif_obj.sd =kcalloc (subdev_count,sizeof (*vpif_obj.sd),GFP_KERNEL ); -if (vpif_obj.sd =NULL ) { +if (!vpif_obj.sd) { err = -ENOMEM ; goto vpif_unregister; }
Signature · 1 line
2.10.1
Hello,
Thanks for the patches.
Quoted 42 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 12 Oct 2016 16:20:02 +0200Several update suggestions were taken into account from static source code analysis.
Markus Elfring (34):
Usekmalloc_array()invpbe_initialize()
Delete two error messages for a failed memory allocation
Adjust 16 checks for null pointers
Combine substrings for four messages
Return an error code only as a constant invpbe_probe()
Return an error code only by a single variable invpbe_initialize()Delete an unnecessary variable initialisation invpbe_initialize()Return the success indication only as a constant invpbe_set_mode()Reduce the scope for a variable invpbe_set_default_output()
Check return value of asetup_if_config()call invpbe_set_output()Rename a jump label invpbe_set_output()
Delete an unnecessary variable initialisation invpbe_set_output()
Capture: Usekmalloc_array()invpfe_probe()
Capture: Delete three error messages for a failed memory allocation
Capture: Improve another size determination invpfe_probe()
Capture: Delete an unnecessary variable initialisation invpfe_probe()
Capture: Improve another size determination invpfe_enum_input()
Capture: Combine substrings for an error message invpfe_enum_input()
Capture: Improve another size determination invpfe_open()
Capture: Adjust 13 checks for null pointers
Capture: Delete an unnecessary variable initialisation in 11 functions
Capture: Move two assignments invpfe_s_input()
Capture: Delete unnecessary braces invpfe_isr()
Capture: Delete an unnecessary return statement invpfe_unregister_ccdc_device()
Capture: Usekcalloc()invpif_probe()
Capture: Delete an error message for a failed memory allocation
Capture: Adjust ten checks for null pointers
Capture: Delete an unnecessary variable initialisation invpif_querystd()
Capture: Delete an unnecessary variable initialisation invpif_channel_isr()
Display: Usekcalloc()invpif_probe()
Display: Delete an error message for a failed memory allocation
Display: Adjust 11 checks for null pointers
Display: Delete an unnecessary variable initialisation invpif_channel_isr()
Display: Delete an unnecessary variable initialisation inprocess_progressive_mode()
Quoted 6 lines
drivers/media/platform/davinci/vpbe.c | 93 ++++++++++++--------------- drivers/media/platform/davinci/vpfe_capture.c | 88 ++++++++++++------------- drivers/media/platform/davinci/vpif_capture.c | 28 ++++---- drivers/media/platform/davinci/vpif_display.c | 30 ++++----- 4 files changed, 109 insertions(+), 130 deletions(-)
Cheers,
--Prabhakar Lad