public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrei Epure <epure.andrei@gmail.com>
To: inki.dae@samsung.com, dh09.lee@samsung.com,
	kyungmin.park@samsung.com, FlorianSchandinat@gmx.de
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrei Epure <epure.andrei@gmail.com>
Subject: [PATCH] video: exynos: remove useless safety check in list traversal
Date: Wed, 27 Mar 2013 23:19:05 +0200	[thread overview]
Message-ID: <1364419145-30375-1-git-send-email-epure.andrei@gmail.com> (raw)

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


             reply	other threads:[~2013-03-27 21:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27 21:19 Andrei Epure [this message]
2013-03-28  0:04 ` [PATCH] video: exynos: remove useless safety check in list traversal Donghwa Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364419145-30375-1-git-send-email-epure.andrei@gmail.com \
    --to=epure.andrei@gmail.com \
    --cc=FlorianSchandinat@gmx.de \
    --cc=dh09.lee@samsung.com \
    --cc=inki.dae@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox