[PATCH] [media] gsc-m2m: Use an unsigned data type for a variable

2015-12-19 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 19 Dec 2015 15:28:37 +0100

The data type "int" was used by the variable "ret" in the
gsc_m2m_poll() function despite of the aspect that the type "unsigned int"
will usually be needed for the return value from a call of the
v4l2_m2m_poll() function.
Improve this implementation detail by addition of the type modifier then.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/platform/exynos-gsc/gsc-m2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c 
b/drivers/media/platform/exynos-gsc/gsc-m2m.c
index d82e717..f2c091c 100644
--- a/drivers/media/platform/exynos-gsc/gsc-m2m.c
+++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c
@@ -701,7 +701,7 @@ static unsigned int gsc_m2m_poll(struct file *file,
 {
struct gsc_ctx *ctx = fh_to_ctx(file->private_data);
struct gsc_dev *gsc = ctx->gsc_dev;
-   int ret;
+   unsigned int ret;
 
if (mutex_lock_interruptible(>lock))
return -ERESTARTSYS;
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] GPU-DRM-Exynos: Delete unnecessary checks before two function calls

2015-06-27 Thread SF Markus Elfring
 From: Markus Elfring elfr...@users.sourceforge.net
 Date: Wed, 4 Feb 2015 21:54:45 +0100

 The functions phy_power_on() and vunmap() perform also input
 parameter validation. Thus the test around their calls is not needed.

 This issue was detected by using the Coccinelle software.

 Signed-off-by: Markus Elfring elfr...@users.sourceforge.net
 ---
  drivers/gpu/drm/exynos/exynos_dp_core.c   | 6 ++
  drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 2 +-
  2 files changed, 3 insertions(+), 5 deletions(-)

 diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
 b/drivers/gpu/drm/exynos/exynos_dp_core.c
 index 34d46aa..306cf1d 100644
 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
 +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
 @@ -1057,14 +1057,12 @@ static int exynos_dp_create_connector(struct 
 exynos_drm_display *display,
  
  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
  {
 -if (dp-phy)
 -phy_power_on(dp-phy);
 +phy_power_on(dp-phy);
  }
  
  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
  {
 -if (dp-phy)
 -phy_power_off(dp-phy);
 +phy_power_off(dp-phy);
  }
  
  static void exynos_dp_poweron(struct exynos_drm_display *display)
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
 b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
 index e12ea90..0dd448a 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
 @@ -313,7 +313,7 @@ static void exynos_drm_fbdev_destroy(struct drm_device 
 *dev,
  struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd-exynos_gem_obj;
  struct drm_framebuffer *fb;
  
 -if (is_drm_iommu_supported(dev)  exynos_gem_obj-buffer-kvaddr)
 +if (is_drm_iommu_supported(dev))
  vunmap(exynos_gem_obj-buffer-kvaddr);
  
  /* release drm framebuffer and real buffer */

 
 Acked-by: Joonyoung Shim jy0922.s...@samsung.com

Do the chances increase to integrate this update suggestion
into another source code repository?

Regards,
Markus
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] GPU-DRM-Exynos: Delete unnecessary checks before two function calls

2015-02-04 Thread SF Markus Elfring
From: Markus Elfring elfr...@users.sourceforge.net
Date: Wed, 4 Feb 2015 21:54:45 +0100

The functions phy_power_on() and vunmap() perform also input
parameter validation. Thus the test around their calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring elfr...@users.sourceforge.net
---
 drivers/gpu/drm/exynos/exynos_dp_core.c   | 6 ++
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 34d46aa..306cf1d 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1057,14 +1057,12 @@ static int exynos_dp_create_connector(struct 
exynos_drm_display *display,
 
 static void exynos_dp_phy_init(struct exynos_dp_device *dp)
 {
-   if (dp-phy)
-   phy_power_on(dp-phy);
+   phy_power_on(dp-phy);
 }
 
 static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
 {
-   if (dp-phy)
-   phy_power_off(dp-phy);
+   phy_power_off(dp-phy);
 }
 
 static void exynos_dp_poweron(struct exynos_drm_display *display)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index e12ea90..0dd448a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -313,7 +313,7 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev,
struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd-exynos_gem_obj;
struct drm_framebuffer *fb;
 
-   if (is_drm_iommu_supported(dev)  exynos_gem_obj-buffer-kvaddr)
+   if (is_drm_iommu_supported(dev))
vunmap(exynos_gem_obj-buffer-kvaddr);
 
/* release drm framebuffer and real buffer */
-- 
2.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] thermal: Exynos: Deletion of unnecessary checks before two function calls

2014-11-21 Thread SF Markus Elfring
From: Markus Elfring elfr...@users.sourceforge.net
Date: Fri, 21 Nov 2014 11:06:33 +0100

The functions cpufreq_cooling_unregister() and thermal_zone_device_unregister()
test whether their argument is NULL and then return immediately.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring elfr...@users.sourceforge.net
---
 drivers/thermal/samsung/exynos_thermal_common.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_thermal_common.c 
b/drivers/thermal/samsung/exynos_thermal_common.c
index 3f5ad25..1cbb9d0 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.c
+++ b/drivers/thermal/samsung/exynos_thermal_common.c
@@ -417,12 +417,10 @@ void exynos_unregister_thermal(struct thermal_sensor_conf 
*sensor_conf)
 
th_zone = sensor_conf-pzone_data;
 
-   if (th_zone-therm_dev)
-   thermal_zone_device_unregister(th_zone-therm_dev);
+   thermal_zone_device_unregister(th_zone-therm_dev);
 
for (i = 0; i  th_zone-cool_dev_size; i++) {
-   if (th_zone-cool_dev[i])
-   cpufreq_cooling_unregister(th_zone-cool_dev[i]);
+   cpufreq_cooling_unregister(th_zone-cool_dev[i]);
}
 
dev_info(sensor_conf-dev,
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: thermal: Exynos: Deletion of unnecessary checks before two function calls

2014-11-21 Thread SF Markus Elfring
  for (i = 0; i  th_zone-cool_dev_size; i++) {
 -if (th_zone-cool_dev[i])
 -cpufreq_cooling_unregister(th_zone-cool_dev[i]);
 +cpufreq_cooling_unregister(th_zone-cool_dev[i]);
  }
 
 Now you have unnecessary {}

How are the chances that your source code transformation tool
can also consider the deletion of curly brackets in such an use case?

Can any more pretty-printing rules be integrated from a specific
coding style configuration?

Regards,
Markus

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] thermal: Exynos: Deletion of unnecessary checks before two function calls

2014-11-21 Thread SF Markus Elfring
From: Markus Elfring elfr...@users.sourceforge.net
Date: Fri, 21 Nov 2014 17:11:49 +0100

The functions cpufreq_cooling_unregister() and thermal_zone_device_unregister()
test whether their argument is NULL and then return immediately.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring elfr...@users.sourceforge.net
---
 drivers/thermal/samsung/exynos_thermal_common.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_thermal_common.c 
b/drivers/thermal/samsung/exynos_thermal_common.c
index 3f5ad25..b6be572 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.c
+++ b/drivers/thermal/samsung/exynos_thermal_common.c
@@ -417,13 +417,10 @@ void exynos_unregister_thermal(struct thermal_sensor_conf 
*sensor_conf)
 
th_zone = sensor_conf-pzone_data;
 
-   if (th_zone-therm_dev)
-   thermal_zone_device_unregister(th_zone-therm_dev);
+   thermal_zone_device_unregister(th_zone-therm_dev);
 
-   for (i = 0; i  th_zone-cool_dev_size; i++) {
-   if (th_zone-cool_dev[i])
-   cpufreq_cooling_unregister(th_zone-cool_dev[i]);
-   }
+   for (i = 0; i  th_zone-cool_dev_size; ++i)
+   cpufreq_cooling_unregister(th_zone-cool_dev[i]);
 
dev_info(sensor_conf-dev,
Exynos: Kernel Thermal management unregistered\n);
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] [media] platform: Deletion of unnecessary checks before two function calls

2014-11-20 Thread SF Markus Elfring
From: Markus Elfring elfr...@users.sourceforge.net
Date: Thu, 20 Nov 2014 11:44:20 +0100

The functions i2c_put_adapter() and release_firmware() test whether their
argument is NULL and then return immediately. Thus the test around the call
is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring elfr...@users.sourceforge.net
---
 drivers/media/platform/exynos4-is/fimc-is.c   | 6 ++
 drivers/media/platform/s3c-camif/camif-core.c | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/fimc-is.c 
b/drivers/media/platform/exynos4-is/fimc-is.c
index 5476dce..a1db27b 100644
--- a/drivers/media/platform/exynos4-is/fimc-is.c
+++ b/drivers/media/platform/exynos4-is/fimc-is.c
@@ -428,8 +428,7 @@ static void fimc_is_load_firmware(const struct firmware 
*fw, void *context)
 * needed around for copying to the IS working memory every
 * time before the Cortex-A5 is restarted.
 */
-   if (is-fw.f_w)
-   release_firmware(is-fw.f_w);
+   release_firmware(is-fw.f_w);
is-fw.f_w = fw;
 done:
mutex_unlock(is-lock);
@@ -937,8 +936,7 @@ static int fimc_is_remove(struct platform_device *pdev)
vb2_dma_contig_cleanup_ctx(is-alloc_ctx);
fimc_is_put_clocks(is);
fimc_is_debugfs_remove(is);
-   if (is-fw.f_w)
-   release_firmware(is-fw.f_w);
+   release_firmware(is-fw.f_w);
fimc_is_free_cpu_memory(is);
 
return 0;
diff --git a/drivers/media/platform/s3c-camif/camif-core.c 
b/drivers/media/platform/s3c-camif/camif-core.c
index b385747..3b09b5b 100644
--- a/drivers/media/platform/s3c-camif/camif-core.c
+++ b/drivers/media/platform/s3c-camif/camif-core.c
@@ -256,8 +256,7 @@ static void camif_unregister_sensor(struct camif_dev *camif)
v4l2_device_unregister_subdev(sd);
camif-sensor.sd = NULL;
i2c_unregister_device(client);
-   if (adapter)
-   i2c_put_adapter(adapter);
+   i2c_put_adapter(adapter);
 }
 
 static int camif_create_media_links(struct camif_dev *camif)
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html