From patchwork Sun Sep 20 17:09:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrique de Moraes Holschuh X-Patchwork-Id: 48919 X-Patchwork-Delegate: lenb@kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8KHA3qu012371 for ; Sun, 20 Sep 2009 17:10:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754800AbZITRKU (ORCPT ); Sun, 20 Sep 2009 13:10:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754851AbZITRKT (ORCPT ); Sun, 20 Sep 2009 13:10:19 -0400 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:46977 "EHLO out1.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754800AbZITRKT (ORCPT ); Sun, 20 Sep 2009 13:10:19 -0400 Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id F162A6ECD7; Sun, 20 Sep 2009 13:10:22 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Sun, 20 Sep 2009 13:10:23 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; s=smtpout; bh=pYLGFsaHKbIMXytbS2SljpXQPe4=; b=BGre+DTnocV6EZWav0unH1OsnJPqK560h5aOFDnuGYgH2mYuO8jD+U4JrPEbbSl5BDsQkFBUeDQ+XyPu0KxUhlcOlC4WyJy+sTjYz+CpYOatH64rkE9YfMc7nHUiZ1oSA9btmVZ60m5/FvwrHp53a2E/miOmsJnRkx79v6KZNwI= X-Sasl-enc: clXO4ycnKQSBXFangz8HtyAP+ow56LJesgaV9i0YLR3L 1253466622 Received: from thorin.khazad-dum.debian.net (187-27-2-224.3g.claro.net.br [187.27.2.224]) by mail.messagingengine.com (Postfix) with ESMTPSA id 0D66810714; Sun, 20 Sep 2009 13:10:22 -0400 (EDT) Received: by thorin.khazad-dum.debian.net (Postfix, from userid 1000) id E30511E9A9C; Sun, 20 Sep 2009 14:09:30 -0300 (BRT) From: Henrique de Moraes Holschuh To: Len Brown Cc: linux-acpi@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, Henrique de Moraes Holschuh Subject: [PATCH 1/6] thinkpad-acpi: don't leave ERR_PTR() pointers around Date: Sun, 20 Sep 2009 14:09:22 -0300 Message-Id: <1253466567-4285-2-git-send-email-hmh@hmh.eng.br> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1253466567-4285-1-git-send-email-hmh@hmh.eng.br> References: <1253466567-4285-1-git-send-email-hmh@hmh.eng.br> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org backlight_device_register returns ERR_PTR() in case of problems, and the current code would leave that ERR_PTR in ibm_backlight_device. The current code paths won't touch it in that situation, but that could change. Make sure to set ibm_backlight_device to NULL in the error path. Signed-off-by: Henrique de Moraes Holschuh --- drivers/platform/x86/thinkpad_acpi.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index f78d275..b789ee8 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -6010,8 +6010,10 @@ static int __init brightness_init(struct ibm_init_struct *iibm) TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, &ibm_backlight_data); if (IS_ERR(ibm_backlight_device)) { + int rc = PTR_ERR(ibm_backlight_device); + ibm_backlight_device = NULL; printk(TPACPI_ERR "Could not register backlight device\n"); - return PTR_ERR(ibm_backlight_device); + return rc; } vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT, "brightness is supported\n");