diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2009-09-20 19:09:22 +0200 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-09-20 19:43:29 +0200 |
commit | 435c47e20bc212d0fa6652ac93fae8eaee7b9b34 (patch) | |
tree | 2cd23fc6a2324023f728a8595c42d82d842e3cef /drivers/platform | |
parent | thinkpad_acpi: fix rfkill memory leak on unload (diff) | |
download | linux-435c47e20bc212d0fa6652ac93fae8eaee7b9b34.tar.xz linux-435c47e20bc212d0fa6652ac93fae8eaee7b9b34.zip |
thinkpad-acpi: don't leave ERR_PTR() pointers around
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 <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | 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 f78d27503925..b789ee8bc14e 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"); |