From patchwork Thu May 9 08:27:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Libo Chen X-Patchwork-Id: 242725 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 61B182C00ED for ; Thu, 9 May 2013 18:28:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752484Ab3EII2M (ORCPT ); Thu, 9 May 2013 04:28:12 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:26494 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752368Ab3EII2H (ORCPT ); Thu, 9 May 2013 04:28:07 -0400 Received: from 172.24.2.119 (EHLO szxeml206-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BBI07218; Thu, 09 May 2013 16:27:46 +0800 (CST) Received: from SZXEML408-HUB.china.huawei.com (10.82.67.95) by szxeml206-edg.china.huawei.com (172.24.2.59) with Microsoft SMTP Server (TLS) id 14.1.323.7; Thu, 9 May 2013 16:27:18 +0800 Received: from localhost (10.135.72.158) by szxeml408-hub.china.huawei.com (10.82.67.95) with Microsoft SMTP Server id 14.1.323.7; Thu, 9 May 2013 16:27:26 +0800 From: Libo Chen To: , CC: , , , , Libo Chen Subject: [PATCH v2 2/2] i2c: pxa: no need release_mem_region before request_mem_region successful Date: Thu, 9 May 2013 16:27:24 +0800 Message-ID: <1368088044-20408-3-git-send-email-libo.chen@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 In-Reply-To: <1368088044-20408-1-git-send-email-libo.chen@huawei.com> References: <1368088044-20408-1-git-send-email-libo.chen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.135.72.158] X-CFilter-Loop: Reflected Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org When kzalloc fail, there is no reason to release_mem_region fix confuse tag, add new tag: emem, eirq, edt and make it cleanly Signed-off-by: Libo Chen --- drivers/i2c/busses/i2c-pxa.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index ea6d45d..a9da954 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -1104,18 +1104,18 @@ static int i2c_pxa_probe(struct platform_device *dev) if (ret > 0) ret = i2c_pxa_probe_pdata(dev, i2c, &i2c_type); if (ret < 0) - goto eclk; + goto edt; res = platform_get_resource(dev, IORESOURCE_MEM, 0); irq = platform_get_irq(dev, 0); if (res == NULL || irq < 0) { ret = -ENODEV; - goto eclk; + goto eirq; } if (!request_mem_region(res->start, resource_size(res), res->name)) { ret = -ENOMEM; - goto eclk; + goto emem; } i2c->adap.owner = THIS_MODULE; @@ -1207,9 +1207,12 @@ ereqirq: eremap: clk_put(i2c->clk); eclk: - kfree(i2c); -emalloc: release_mem_region(res->start, resource_size(res)); +emem: +eirq: +edt: + kfree(i2c); +emalloc: return ret; }