From patchwork Thu Nov 4 17:39:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 302492 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA4Hdh0K010270 for ; Thu, 4 Nov 2010 17:39:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751966Ab0KDRjk (ORCPT ); Thu, 4 Nov 2010 13:39:40 -0400 Received: from mail-gx0-f174.google.com ([209.85.161.174]:49196 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849Ab0KDRjk (ORCPT ); Thu, 4 Nov 2010 13:39:40 -0400 Received: by gxk23 with SMTP id 23so1617586gxk.19 for ; Thu, 04 Nov 2010 10:39:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=xt4+QaJSDURnqMIzmLGVu+woArcPrPWtVUMVSFzFQng=; b=QcaB/5UgGSlDJaz5IFFIdTDbgMkkW3oBhCPoZCyxCrzFF7ACaVhUDkVJUUByYNRhBO 3pDClgsoh+wL/KGzJI6jJDFdKSx7+gTItCzxDN+tWIKzZe5YwZ+NZSGzw3Mn3F+2KrNC mVvnw9F0AVHpwufTk6w7ESA//wj3Q5lmNI5MI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=mEDXPj31BeihNicAJZ5JnjbwbCbsmZ8Vngu+w1EqnCIfJnYeMoGZz/gTsXdFnuAklZ hudtAax/lEbqrNExRPMWftg/HtIBXOyMagZnjgiKACql4+h4byNBG2UgdYtfgZgXi+Su ADzVUIBxBIr/yTZIfkVZoVazPX/kqO8MQTnbQ= Received: by 10.101.69.10 with SMTP id w10mr866909ank.144.1288892379277; Thu, 04 Nov 2010 10:39:39 -0700 (PDT) Received: from mailhub.coreip.homeip.net (c-24-6-153-206.hsd1.ca.comcast.net [24.6.153.206]) by mx.google.com with ESMTPS id g18sm182707anh.38.2010.11.04.10.39.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 04 Nov 2010 10:39:37 -0700 (PDT) Date: Thu, 4 Nov 2010 10:39:30 -0700 From: Dmitry Torokhov To: linux-acpi@vger.kernel.org Cc: Len Brown Subject: [PATCH] PNPACPI: check return value of pnp_add_device() Message-ID: <20101104173929.GA11251@core.coreip.homeip.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 (demeter1.kernel.org [140.211.167.41]); Thu, 04 Nov 2010 17:39:44 +0000 (UTC) diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 2d73dfc..06ee06c 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c @@ -194,8 +194,9 @@ static char *pnpacpi_get_id(struct acpi_device *device) static int __init pnpacpi_add_device(struct acpi_device *device) { - acpi_handle temp = NULL; + acpi_handle temp; acpi_status status; + int error; struct pnp_dev *dev; char *pnpid; struct acpi_hardware_id *id; @@ -256,10 +257,16 @@ static int __init pnpacpi_add_device(struct acpi_device *device) /* clear out the damaged flags */ if (!dev->active) pnp_init_resources(dev); - pnp_add_device(dev); + + error = pnp_add_device(dev); + if (error) { + put_device(&dev->dev); + return error; + } + num++; - return AE_OK; + return 0; } static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,