On Sat, 2009-08-08 at 15:26 +0800, Dmitry Torokhov wrote: > thermal_cooling_device_register() returns error encoded in a pointer > when it fails in which case we need to explictly set device->cdev > to NULL so we don't try to unregister it when unloading. > > Signed-off-by: Dmitry Torokhov <dtor@xxxxxxx> Acked-by: Zhang Rui <rui.zhang@xxxxxxxxx> > --- > > drivers/acpi/video.c | 12 +++++++++++- > 1 files changed, 11 insertions(+), 1 deletions(-) > > diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c > index d8e64cf..98ade4e 100644 > --- a/drivers/acpi/video.c > +++ b/drivers/acpi/video.c > @@ -992,8 +992,18 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) > > device->cdev = thermal_cooling_device_register("LCD", > device->dev, &video_cooling_ops); > - if (IS_ERR(device->cdev)) > + if (IS_ERR(device->cdev)) { > + /* > + * Set cdev to NULL so we don't crash trying to > + * free it. > + * Also, why the hell we are returnign early and > + * not attempt to register video output if cooling > + * device registration failed? > + * -- dtor > + */ > + device->cdev = NULL; > return; > + } > > dev_info(&device->dev->dev, "registered as cooling_device%d\n", > device->cdev->id); > -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html