diff options
author | Alan Jenkins <alan-jenkins@tuffmail.co.uk> | 2009-12-03 02:45:00 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-09 15:54:31 -0500 |
commit | a2a1d36c78e90977e4ded9a20a7d8d27d84b13e4 (patch) | |
tree | 2e6cdeeae0066fb72e105ab1029c057c8d49996c /drivers/platform | |
parent | 13f70029daa3cd7f9983e4aec82f32939b1a6e6a (diff) |
eeepc-laptop: remove redundant NULL checks
eeepc_hotk_notify() cannot be called with ehotk == NULL or bd == NULL.
We check both variables for allocation failure and would bail out before
the notifier is registered.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index abd7389a4493..f6b7796b24ca 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -662,12 +662,11 @@ static int notify_brn(void) | |||
662 | { | 662 | { |
663 | /* returns the *previous* brightness, or -1 */ | 663 | /* returns the *previous* brightness, or -1 */ |
664 | struct backlight_device *bd = eeepc_backlight_device; | 664 | struct backlight_device *bd = eeepc_backlight_device; |
665 | if (bd) { | 665 | int old = bd->props.brightness; |
666 | int old = bd->props.brightness; | 666 | |
667 | backlight_force_update(bd, BACKLIGHT_UPDATE_HOTKEY); | 667 | backlight_force_update(bd, BACKLIGHT_UPDATE_HOTKEY); |
668 | return old; | 668 | |
669 | } | 669 | return old; |
670 | return -1; | ||
671 | } | 670 | } |
672 | 671 | ||
673 | static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot, | 672 | static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot, |
@@ -741,8 +740,6 @@ static void eeepc_hotk_notify(struct acpi_device *device, u32 event) | |||
741 | u16 count; | 740 | u16 count; |
742 | int brn = -ENODEV; | 741 | int brn = -ENODEV; |
743 | 742 | ||
744 | if (!ehotk) | ||
745 | return; | ||
746 | if (event > ACPI_MAX_SYS_NOTIFY) | 743 | if (event > ACPI_MAX_SYS_NOTIFY) |
747 | return; | 744 | return; |
748 | if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) | 745 | if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) |
@@ -753,21 +750,20 @@ static void eeepc_hotk_notify(struct acpi_device *device, u32 event) | |||
753 | dev_name(&ehotk->device->dev), event, | 750 | dev_name(&ehotk->device->dev), event, |
754 | count); | 751 | count); |
755 | if (ehotk->inputdev) { | 752 | if (ehotk->inputdev) { |
756 | if (brn != -ENODEV) { | 753 | /* brightness-change events need special |
757 | /* brightness-change events need special | 754 | * handling for conversion to key events |
758 | * handling for conversion to key events | 755 | */ |
759 | */ | 756 | if (brn < 0) |
760 | if (brn < 0) | 757 | brn = event; |
761 | brn = event; | 758 | else |
762 | else | 759 | brn += NOTIFY_BRN_MIN; |
763 | brn += NOTIFY_BRN_MIN; | 760 | if (event < brn) |
764 | if (event < brn) | 761 | event = NOTIFY_BRN_MIN; /* brightness down */ |
765 | event = NOTIFY_BRN_MIN; /* brightness down */ | 762 | else if (event > brn) |
766 | else if (event > brn) | 763 | event = NOTIFY_BRN_MIN + 2; /* ... up */ |
767 | event = NOTIFY_BRN_MIN + 2; /* ... up */ | 764 | else |
768 | else | 765 | event = NOTIFY_BRN_MIN + 1; /* ... unchanged */ |
769 | event = NOTIFY_BRN_MIN + 1; /* ... unchanged */ | 766 | |
770 | } | ||
771 | key = eepc_get_entry_by_scancode(event); | 767 | key = eepc_get_entry_by_scancode(event); |
772 | if (key) { | 768 | if (key) { |
773 | switch (key->type) { | 769 | switch (key->type) { |