Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1499717 > unrolled thread

[PATCH 00/34] [media] DaVinci-Video Processing: Fine-tuning for several function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-10-12 16:30 +0200
Last post2016-10-23 19:30 +0200
Articles 20 on this page of 36 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/34] [media] DaVinci-Video Processing: Fine-tuning for  several function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 16:30 +0200
    [PATCH 01/34] [media] DaVinci-VPBE: Use kmalloc_array() in  vpbe_initialize() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 16:30 +0200
    [PATCH 04/34] [media] DaVinci-VPBE: Combine substrings for four  messages SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 16:40 +0200
    [PATCH 02/34] [media] DaVinci-VPBE: Delete two error messages for a  failed memory allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 16:40 +0200
    [PATCH 10/34] [media] DaVinci-VPBE: Check return value of a  setup_if_config() call in vpbe_set_output() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 16:50 +0200
    [PATCH 09/34] [media] DaVinci-VPBE: Reduce the scope for a variable  in vpbe_set_default_output() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 16:50 +0200
    [PATCH 06/34] [media] DaVinci-VPBE: Return an error code only by a  single variable in vpbe_initialize() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 16:50 +0200
    [PATCH 08/34] [media] DaVinci-VPBE: Return the success indication  only as a constant in vpbe_set_mode() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 16:50 +0200
    [PATCH 07/34] [media] DaVinci-VPBE: Delete an unnecessary variable  initialisation in vpbe_initialize() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 16:50 +0200
    [PATCH 05/34] [media] DaVinci-VPBE: Return an error code only as a  constant in vpbe_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 16:50 +0200
    [PATCH 13/34] [media] DaVinci-VPFE-Capture: Use kmalloc_array() in  vpfe_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:00 +0200
    [PATCH 12/34] [media] DaVinci-VPBE: Delete an unnecessary variable  initialisation in vpbe_set_output() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:00 +0200
    [PATCH 18/34] [media] DaVinci-VPFE-Capture: Combine substrings for an  error message in vpfe_enum_input() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:00 +0200
    [PATCH 15/34] [media] DaVinci-VPFE-Capture: Improve another size  determination in vpfe_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:00 +0200
    [PATCH 16/34] [media] DaVinci-VPFE-Capture: Delete an unnecessary  variable initialisation in vpfe_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:00 +0200
    [PATCH 11/34] [media] DaVinci-VPBE: Rename a jump label in  vpbe_set_output() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:00 +0200
    [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size  determination in vpfe_enum_input() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:00 +0200
    [PATCH 25/34] [media] DaVinci-VPIF-Capture: Use kcalloc() in  vpif_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:10 +0200
    [PATCH 20/34] [media] DaVinci-VPFE-Capture: Adjust 13 checks for null  pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:10 +0200
    [PATCH 22/34] [media] DaVinci-VPFE-Capture: Move two assignments in  vpfe_s_input() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:10 +0200
    [PATCH 24/34] [media] DaVinci-VPFE-Capture: Delete an unnecessary  return statement in vpfe_unregister_ccdc_device() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:10 +0200
    [PATCH 19/34] [media] DaVinci-VPFE-Capture: Improve another size  determination in vpfe_open() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:10 +0200
    [PATCH 28/34] [media] DaVinci-VPIF-Capture: Delete an unnecessary  variable initialisation in vpif_querystd() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:10 +0200
    [PATCH 26/34] [media] DaVinci-VPIF-Capture: Delete an error message  for a failed memory allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:10 +0200
    [PATCH 23/34] [media] DaVinci-VPFE-Capture: Delete unnecessary braces  in vpfe_isr() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:10 +0200
    [PATCH 14/34] [media] DaVinci-VPFE-Capture: Delete three error  messages for a failed memory allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:10 +0200
    [PATCH 21/34] [media] DaVinci-VPFE-Capture: Delete an unnecessary  variable initialisation in 11 functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:10 +0200
    [PATCH 32/34] [media] DaVinci-VPIF-Display: Adjust 11 checks for null  pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:20 +0200
    [PATCH 30/34] [media] DaVinci-VPIF-Display: Use kcalloc() in  vpif_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:20 +0200
    [PATCH 33/34] [media] DaVinci-VPIF-Display: Delete an unnecessary  variable initialisation in vpif_channel_isr() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:20 +0200
    [PATCH 31/34] [media] DaVinci-VPIF-Display: Delete an error message  for a failed memory allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:20 +0200
    [PATCH 34/34] [media] DaVinci-VPIF-Display: Delete an unnecessary  variable initialisation in process_progressive_mode() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:20 +0200
    [PATCH 29/34] [media] DaVinci-VPIF-Capture: Delete an unnecessary  variable initialisation in vpif_channel_isr() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 17:20 +0200
    [PATCH resent 03/34] [media] DaVinci-VPBE: Adjust 16 checks for null  pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 19:20 +0200
    [PATCH resent 27/34] [media] DaVinci-VPIF-Capture: Adjust ten checks  for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-12 19:20 +0200
    Re: [PATCH 00/34] [media] DaVinci-Video Processing: Fine-tuning for  several function implementations "Lad, Prabhakar" <prabhakar.csengg@gmail.com> - 2016-10-23 19:30 +0200

Page 1 of 2  [1] 2  Next page →


#1499717 — [PATCH 00/34] [media] DaVinci-Video Processing: Fine-tuning for several function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 16:30 +0200
Subject[PATCH 00/34] [media] DaVinci-Video Processing: Fine-tuning for several function implementations
Message-ID<srsHD-5Fa-11@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
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(-)

-- 
2.10.1

[toc] | [next] | [standalone]


#1499719 — [PATCH 01/34] [media] DaVinci-VPBE: Use kmalloc_array() in vpbe_initialize()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 16:30 +0200
Subject[PATCH 01/34] [media] DaVinci-VPBE: Use kmalloc_array() in vpbe_initialize()
Message-ID<srsHE-5Fa-23@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpbe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 9a6c2cc..8c062ff 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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");
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499722 — [PATCH 04/34] [media] DaVinci-VPBE: Combine substrings for four messages

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 16:40 +0200
Subject[PATCH 04/34] [media] DaVinci-VPBE: Combine substrings for four messages
Message-ID<srsRj-5Ir-1@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpbe.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 496b27f..625bddf 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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;
 	}
 
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499727 — [PATCH 02/34] [media] DaVinci-VPBE: Delete two error messages for a failed memory allocation

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 16:40 +0200
Subject[PATCH 02/34] [media] DaVinci-VPBE: Delete two error messages for a failed memory allocation
Message-ID<srsRk-5Ir-25@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

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/davinci/vpbe.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 8c062ff..b479747 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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;
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499729 — [PATCH 10/34] [media] DaVinci-VPBE: Check return value of a setup_if_config() call in vpbe_set_output()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 16:50 +0200
Subject[PATCH 10/34] [media] DaVinci-VPBE: Check return value of a setup_if_config() call in vpbe_set_output()
Message-ID<srt10-5LT-19@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpbe.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 19611a2..6e7b0df 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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;
 	}
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499730 — [PATCH 09/34] [media] DaVinci-VPBE: Reduce the scope for a variable in vpbe_set_default_output()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 16:50 +0200
Subject[PATCH 09/34] [media] DaVinci-VPBE: Reduce the scope for a variable in vpbe_set_default_output()
Message-ID<srt0Z-5LT-3@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpbe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index d6a0221..19611a2 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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;
 }
 
 /**
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499731 — [PATCH 06/34] [media] DaVinci-VPBE: Return an error code only by a single variable in vpbe_initialize()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 16:50 +0200
Subject[PATCH 06/34] [media] DaVinci-VPBE: Return an error code only by a single variable in vpbe_initialize()
Message-ID<srt10-5LT-5@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Fixes: 66715cdc3224a4e241c1a92856b9a4af3b70e06d ("[media] davinci vpbe:
VPBE display driver")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 4c4cd81..afa8ff7 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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;
 		}
 	}
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499732 — [PATCH 08/34] [media] DaVinci-VPBE: Return the success indication only as a constant in vpbe_set_mode()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 16:50 +0200
Subject[PATCH 08/34] [media] DaVinci-VPBE: Return the success indication only as a constant in vpbe_set_mode()
Message-ID<srt10-5LT-13@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpbe.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 9fdd8c0..d6a0221 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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)
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499733 — [PATCH 07/34] [media] DaVinci-VPBE: Delete an unnecessary variable initialisation in vpbe_initialize()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 16:50 +0200
Subject[PATCH 07/34] [media] DaVinci-VPBE: Delete an unnecessary variable initialisation in vpbe_initialize()
Message-ID<srt10-5LT-15@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index afa8ff7..9fdd8c0 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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;
 
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499735 — [PATCH 05/34] [media] DaVinci-VPBE: Return an error code only as a constant in vpbe_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 16:50 +0200
Subject[PATCH 05/34] [media] DaVinci-VPBE: Return an error code only as a constant in vpbe_probe()
Message-ID<srt10-5LT-17@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpbe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 625bddf..4c4cd81 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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);
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499739 — [PATCH 13/34] [media] DaVinci-VPFE-Capture: Use kmalloc_array() in vpfe_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 17:00 +0200
Subject[PATCH 13/34] [media] DaVinci-VPFE-Capture: Use kmalloc_array() in vpfe_probe()
Message-ID<srtaG-5Pq-5@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpfe_capture.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 6efb2f1..5c1b8cf 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -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");
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499740 — [PATCH 12/34] [media] DaVinci-VPBE: Delete an unnecessary variable initialisation in vpbe_set_output()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 17:00 +0200
Subject[PATCH 12/34] [media] DaVinci-VPBE: Delete an unnecessary variable initialisation in vpbe_set_output()
Message-ID<srtaF-5Pq-1@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index e68a792..b2c5d8f 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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;
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499741 — [PATCH 18/34] [media] DaVinci-VPFE-Capture: Combine substrings for an error message in vpfe_enum_input()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 17:00 +0200
Subject[PATCH 18/34] [media] DaVinci-VPFE-Capture: Combine substrings for an error message in vpfe_enum_input()
Message-ID<srtaG-5Pq-11@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpfe_capture.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 87ee35d..ee7b3e3 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -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];
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499742 — [PATCH 15/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 17:00 +0200
Subject[PATCH 15/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_probe()
Message-ID<srtaG-5Pq-13@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpfe_capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 23142f0..4db3212 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -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;
 
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499743 — [PATCH 16/34] [media] DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in vpfe_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 17:00 +0200
Subject[PATCH 16/34] [media] DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in vpfe_probe()
Message-ID<srtaG-5Pq-15@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpfe_capture.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 4db3212..8314c39 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -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;
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499745 — [PATCH 11/34] [media] DaVinci-VPBE: Rename a jump label in vpbe_set_output()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 17:00 +0200
Subject[PATCH 11/34] [media] DaVinci-VPBE: Rename a jump label in vpbe_set_output()
Message-ID<srtaG-5Pq-3@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 12 Oct 2016 10:10:19 +0200

Adjust jump labels according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpbe.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 6e7b0df..e68a792 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -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;
 }
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499746 — [PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_enum_input()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 17:00 +0200
Subject[PATCH 17/34] [media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_enum_input()
Message-ID<srtaG-5Pq-19@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpfe_capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 8314c39..87ee35d 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -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;
 }
 
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499748 — [PATCH 25/34] [media] DaVinci-VPIF-Capture: Use kcalloc() in vpif_probe()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 17:10 +0200
Subject[PATCH 25/34] [media] DaVinci-VPIF-Capture: Use kcalloc() in vpif_probe()
Message-ID<srtkl-688-3@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpif_capture.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 5104cc0..fb9e850 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -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;
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499749 — [PATCH 20/34] [media] DaVinci-VPFE-Capture: Adjust 13 checks for null pointers

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 17:10 +0200
Subject[PATCH 20/34] [media] DaVinci-VPFE-Capture: Adjust 13 checks for null pointers
Message-ID<srtkl-688-1@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 12 Oct 2016 10:46:28 +0200

Convert comparisons with the preprocessor symbol "NULL" to condition checks
without it.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpfe_capture.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index e370400..9da353b 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -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;
 	}
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1499752 — [PATCH 22/34] [media] DaVinci-VPFE-Capture: Move two assignments in vpfe_s_input()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-12 17:10 +0200
Subject[PATCH 22/34] [media] DaVinci-VPFE-Capture: Move two assignments in vpfe_s_input()
Message-ID<srtkm-688-9@gated-at.bofh.it>
In reply to#1499717
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/platform/davinci/vpfe_capture.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index ba71310..f0467fe 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -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)
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.kernel


csiph-web