memset(&props, 0, sizeof(struct backlight_properties));
        props.type = BACKLIGHT_RAW;
        props.max_brightness = machinfo->max_intensity;
-       bd = backlight_device_register(name, &pdev->dev, NULL, &genericbl_ops,
-                                      &props);
+       bd = devm_backlight_device_register(&pdev->dev, name, &pdev->dev,
+                                       NULL, &genericbl_ops, &props);
        if (IS_ERR(bd))
                return PTR_ERR(bd);
 
        bd->props.brightness = 0;
        backlight_update_status(bd);
 
-       backlight_device_unregister(bd);
-
        dev_info(&pdev->dev, "Generic Backlight Driver Unloaded\n");
        return 0;
 }