From patchwork Thu Mar 18 17:59:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 86778 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2II0PpZ020154 for ; Thu, 18 Mar 2010 18:00:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754032Ab0CRR7n (ORCPT ); Thu, 18 Mar 2010 13:59:43 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:37163 "EHLO g4t0015.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753755Ab0CRR7m (ORCPT ); Thu, 18 Mar 2010 13:59:42 -0400 Received: from g4t0009.houston.hp.com (g4t0009.houston.hp.com [16.234.32.26]) by g4t0015.houston.hp.com (Postfix) with ESMTP id 3ACB6800E; Thu, 18 Mar 2010 17:59:41 +0000 (UTC) Received: from ldl (ldl.fc.hp.com [15.11.146.30]) by g4t0009.houston.hp.com (Postfix) with ESMTP id 225C0C109; Thu, 18 Mar 2010 17:59:41 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id 18BB8CF0054; Thu, 18 Mar 2010 11:59:41 -0600 (MDT) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dxNynAjZA9lD; Thu, 18 Mar 2010 11:59:41 -0600 (MDT) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id 02745CF000A; Thu, 18 Mar 2010 11:59:41 -0600 (MDT) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id D17F4262A0; Thu, 18 Mar 2010 11:59:40 -0600 (MDT) Subject: [PATCH v2 3/4] hpet: clean up io mapping when hpet_alloc() fails To: Clemens Ladisch From: Bjorn Helgaas Cc: Venkatesh Pallipadi , Vojtech Pavlik , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Date: Thu, 18 Mar 2010 11:59:40 -0600 Message-ID: <20100318175940.15143.53027.stgit@bob.kio> In-Reply-To: <20100318175852.15143.2124.stgit@bob.kio> References: <20100318175852.15143.2124.stgit@bob.kio> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 18 Mar 2010 18:00:26 +0000 (UTC) diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index d132fef..8961985 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -904,7 +904,7 @@ static int hpet_pnp_add(struct pnp_dev *dev, const struct pnp_device_id *dev_id) { struct hpet_data data; struct resource *mem, *irq; - int i; + int i, ret; memset(&data, 0, sizeof(data)); @@ -924,7 +924,11 @@ static int hpet_pnp_add(struct pnp_dev *dev, const struct pnp_device_id *dev_id) data.hd_phys_address = mem->start; data.hd_address = ioremap(mem->start, resource_size(mem)); - return hpet_alloc(&data); + ret = hpet_alloc(&data); + if (ret) + iounmap(data.hd_address); + + return ret; } static void hpet_pnp_remove(struct pnp_dev *dev)