ACPI: sbs: check for NULL device pointer
authorLebedev, Vladimir P <vladimir.p.lebedev@intel.com>
Tue, 5 Sep 2006 15:49:13 +0000 (19:49 +0400)
committerLen Brown <len.brown@intel.com>
Sat, 14 Oct 2006 04:33:52 +0000 (00:33 -0400)
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/sbs.c

index 62bef0b3b614aef8d10742cd3494e9ecca149675..79f38f0367757e460610031bba64e9b62873689d 100644 (file)
@@ -1685,10 +1685,16 @@ static int acpi_sbs_add(struct acpi_device *device)
 
 int acpi_sbs_remove(struct acpi_device *device, int type)
 {
-       struct acpi_sbs *sbs = (struct acpi_sbs *)acpi_driver_data(device);
+       struct acpi_sbs *sbs = NULL;
        int id;
 
-       if (!device || !sbs) {
+       if (!device) {
+               return -EINVAL;
+       }
+
+       sbs = (struct acpi_sbs *)acpi_driver_data(device);
+
+       if (!sbs) {
                return -EINVAL;
        }