public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] video: exynos: remove useless safety check in list traversal
@ 2013-03-27 21:19 Andrei Epure
  2013-03-28  0:04 ` Donghwa Lee
  0 siblings, 1 reply; 2+ messages in thread
From: Andrei Epure @ 2013-03-27 21:19 UTC (permalink / raw)
  To: inki.dae, dh09.lee, kyungmin.park, FlorianSchandinat
  Cc: linux-fbdev, linux-kernel, Andrei Epure

list_for_each_entry_safe() does not require safety check.
Patch found using coccinelle.

Signed-off-by: Andrei Epure <epure.andrei@gmail.com>
---
 drivers/video/exynos/exynos_mipi_dsi.c |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c
index dd5e5e9..fe84f08 100644
--- a/drivers/video/exynos/exynos_mipi_dsi.c
+++ b/drivers/video/exynos/exynos_mipi_dsi.c
@@ -214,8 +214,6 @@ static struct mipi_dsim_ddi *exynos_mipi_dsi_find_lcd_device(
 	mutex_lock(&mipi_dsim_lock);
 
 	list_for_each_entry_safe(dsim_ddi, next, &dsim_ddi_list, list) {
-		if (!dsim_ddi)
-			goto out;
 
 		lcd_dev = dsim_ddi->dsim_lcd_dev;
 		if (!lcd_dev)
@@ -473,17 +471,15 @@ static int exynos_mipi_dsi_remove(struct platform_device *pdev)
 	clk_disable(dsim->clock);
 
 	list_for_each_entry_safe(dsim_ddi, next, &dsim_ddi_list, list) {
-		if (dsim_ddi) {
-			if (dsim->id != dsim_ddi->bus_id)
-				continue;
+		if (dsim->id != dsim_ddi->bus_id)
+			continue;
 
-			dsim_lcd_drv = dsim_ddi->dsim_lcd_drv;
+		dsim_lcd_drv = dsim_ddi->dsim_lcd_drv;
 
-			if (dsim_lcd_drv->remove)
-				dsim_lcd_drv->remove(dsim_ddi->dsim_lcd_dev);
+		if (dsim_lcd_drv->remove)
+			dsim_lcd_drv->remove(dsim_ddi->dsim_lcd_dev);
 
-			kfree(dsim_ddi);
-		}
+		kfree(dsim_ddi);
 	}
 
 	return 0;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-28  0:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27 21:19 [PATCH] video: exynos: remove useless safety check in list traversal Andrei Epure
2013-03-28  0:04 ` Donghwa Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox