提交 435c47e2 编写于 作者: H Henrique de Moraes Holschuh 提交者: Len Brown

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: NHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 5f0dadb4
...@@ -6010,8 +6010,10 @@ static int __init brightness_init(struct ibm_init_struct *iibm) ...@@ -6010,8 +6010,10 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL,
&ibm_backlight_data); &ibm_backlight_data);
if (IS_ERR(ibm_backlight_device)) { 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"); 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, vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT,
"brightness is supported\n"); "brightness is supported\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册