mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 05:36:43 +07:00
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>
This commit is contained in:
parent
13f70029da
commit
a2a1d36c78
@ -662,12 +662,11 @@ static int notify_brn(void)
|
|||||||
{
|
{
|
||||||
/* returns the *previous* brightness, or -1 */
|
/* returns the *previous* brightness, or -1 */
|
||||||
struct backlight_device *bd = eeepc_backlight_device;
|
struct backlight_device *bd = eeepc_backlight_device;
|
||||||
if (bd) {
|
|
||||||
int old = bd->props.brightness;
|
int old = bd->props.brightness;
|
||||||
|
|
||||||
backlight_force_update(bd, BACKLIGHT_UPDATE_HOTKEY);
|
backlight_force_update(bd, BACKLIGHT_UPDATE_HOTKEY);
|
||||||
|
|
||||||
return old;
|
return old;
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot,
|
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)
|
|||||||
u16 count;
|
u16 count;
|
||||||
int brn = -ENODEV;
|
int brn = -ENODEV;
|
||||||
|
|
||||||
if (!ehotk)
|
|
||||||
return;
|
|
||||||
if (event > ACPI_MAX_SYS_NOTIFY)
|
if (event > ACPI_MAX_SYS_NOTIFY)
|
||||||
return;
|
return;
|
||||||
if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
|
if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
|
||||||
@ -753,7 +750,6 @@ static void eeepc_hotk_notify(struct acpi_device *device, u32 event)
|
|||||||
dev_name(&ehotk->device->dev), event,
|
dev_name(&ehotk->device->dev), event,
|
||||||
count);
|
count);
|
||||||
if (ehotk->inputdev) {
|
if (ehotk->inputdev) {
|
||||||
if (brn != -ENODEV) {
|
|
||||||
/* brightness-change events need special
|
/* brightness-change events need special
|
||||||
* handling for conversion to key events
|
* handling for conversion to key events
|
||||||
*/
|
*/
|
||||||
@ -767,7 +763,7 @@ static void eeepc_hotk_notify(struct acpi_device *device, u32 event)
|
|||||||
event = NOTIFY_BRN_MIN + 2; /* ... up */
|
event = NOTIFY_BRN_MIN + 2; /* ... up */
|
||||||
else
|
else
|
||||||
event = NOTIFY_BRN_MIN + 1; /* ... unchanged */
|
event = NOTIFY_BRN_MIN + 1; /* ... unchanged */
|
||||||
}
|
|
||||||
key = eepc_get_entry_by_scancode(event);
|
key = eepc_get_entry_by_scancode(event);
|
||||||
if (key) {
|
if (key) {
|
||||||
switch (key->type) {
|
switch (key->type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user