From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752860Ab2ALJza (ORCPT ); Thu, 12 Jan 2012 04:55:30 -0500 Received: from mgw2.diku.dk ([130.225.96.92]:41609 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751413Ab2ALJzZ (ORCPT ); Thu, 12 Jan 2012 04:55:25 -0500 From: Julia Lawall To: Liam Girdwood Cc: kernel-janitors@vger.kernel.org, Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/15] sound/soc/mxs/mxs-saif.c: add missing iounmap Date: Thu, 12 Jan 2012 10:55:03 +0100 Message-Id: <1326362117-29371-1-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.7.3.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julia Lawall Add missing iounmap in error handling code, in a case where the function already preforms iounmap on some other execution path. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e; statement S,S1; int ret; @@ e = \(ioremap\|ioremap_nocache\)(...) ... when != iounmap(e) if (<+...e...+>) S ... when any when != iounmap(e) *if (...) { ... when != iounmap(e) return ...; } ... when any iounmap(e); // Signed-off-by: Julia Lawall --- sound/soc/mxs/mxs-saif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index 049e543..5ee0adb 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c @@ -680,7 +680,7 @@ static int mxs_saif_probe(struct platform_device *pdev) ret = -ENODEV; dev_err(&pdev->dev, "failed to get dma resource: %d\n", ret); - goto failed_ioremap; + goto failed_get_resource; } saif->dma_param.chan_num = dmares->start; @@ -739,6 +739,7 @@ failed_register: failed_get_irq2: free_irq(saif->irq, saif); failed_get_irq1: +failed_get_resource: iounmap(saif->base); failed_ioremap: release_mem_region(iores->start, resource_size(iores));