Commit e1a39a44 authored by Barnabás Pőcze's avatar Barnabás Pőcze Committed by Hans de Goede

platform/x86: ideapad-laptop: remove unnecessary NULL checks

The checks that are removed test pointers which should not
be NULL. If they are NULL, that indicates a bug in
a different part of the kernel. Instead of silently
bailing out, let it fail loudly.
Signed-off-by: default avatarBarnabás Pőcze <pobrn@protonmail.com>
Link: https://lore.kernel.org/r/20210203215403.290792-3-pobrn@protonmail.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent a14b3c83
...@@ -264,9 +264,6 @@ static int debugfs_status_show(struct seq_file *s, void *data) ...@@ -264,9 +264,6 @@ static int debugfs_status_show(struct seq_file *s, void *data)
struct ideapad_private *priv = s->private; struct ideapad_private *priv = s->private;
unsigned long value; unsigned long value;
if (!priv)
return -EINVAL;
if (!read_ec_data(priv->adev->handle, VPCCMD_R_BL_MAX, &value)) if (!read_ec_data(priv->adev->handle, VPCCMD_R_BL_MAX, &value))
seq_printf(s, "Backlight max:\t%lu\n", value); seq_printf(s, "Backlight max:\t%lu\n", value);
if (!read_ec_data(priv->adev->handle, VPCCMD_R_BL, &value)) if (!read_ec_data(priv->adev->handle, VPCCMD_R_BL, &value))
...@@ -311,39 +308,36 @@ static int debugfs_cfg_show(struct seq_file *s, void *data) ...@@ -311,39 +308,36 @@ static int debugfs_cfg_show(struct seq_file *s, void *data)
{ {
struct ideapad_private *priv = s->private; struct ideapad_private *priv = s->private;
if (!priv) { seq_printf(s, "cfg: 0x%.8lX\n\nCapability: ",
seq_printf(s, "cfg: N/A\n"); priv->cfg);
} else { if (test_bit(CFG_BT_BIT, &priv->cfg))
seq_printf(s, "cfg: 0x%.8lX\n\nCapability: ", seq_printf(s, "Bluetooth ");
priv->cfg); if (test_bit(CFG_3G_BIT, &priv->cfg))
if (test_bit(CFG_BT_BIT, &priv->cfg)) seq_printf(s, "3G ");
seq_printf(s, "Bluetooth "); if (test_bit(CFG_WIFI_BIT, &priv->cfg))
if (test_bit(CFG_3G_BIT, &priv->cfg)) seq_printf(s, "Wireless ");
seq_printf(s, "3G "); if (test_bit(CFG_CAMERA_BIT, &priv->cfg))
if (test_bit(CFG_WIFI_BIT, &priv->cfg)) seq_printf(s, "Camera ");
seq_printf(s, "Wireless "); seq_printf(s, "\nGraphic: ");
if (test_bit(CFG_CAMERA_BIT, &priv->cfg)) switch ((priv->cfg)&0x700) {
seq_printf(s, "Camera "); case 0x100:
seq_printf(s, "\nGraphic: "); seq_printf(s, "Intel");
switch ((priv->cfg)&0x700) { break;
case 0x100: case 0x200:
seq_printf(s, "Intel"); seq_printf(s, "ATI");
break; break;
case 0x200: case 0x300:
seq_printf(s, "ATI"); seq_printf(s, "Nvidia");
break; break;
case 0x300: case 0x400:
seq_printf(s, "Nvidia"); seq_printf(s, "Intel and ATI");
break; break;
case 0x400: case 0x500:
seq_printf(s, "Intel and ATI"); seq_printf(s, "Intel and Nvidia");
break; break;
case 0x500:
seq_printf(s, "Intel and Nvidia");
break;
}
seq_printf(s, "\n");
} }
seq_printf(s, "\n");
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(debugfs_cfg); DEFINE_SHOW_ATTRIBUTE(debugfs_cfg);
...@@ -1050,9 +1044,6 @@ static int ideapad_backlight_get_brightness(struct backlight_device *blightdev) ...@@ -1050,9 +1044,6 @@ static int ideapad_backlight_get_brightness(struct backlight_device *blightdev)
struct ideapad_private *priv = bl_get_data(blightdev); struct ideapad_private *priv = bl_get_data(blightdev);
unsigned long now; unsigned long now;
if (!priv)
return -EINVAL;
if (read_ec_data(priv->adev->handle, VPCCMD_R_BL, &now)) if (read_ec_data(priv->adev->handle, VPCCMD_R_BL, &now))
return -EIO; return -EIO;
return now; return now;
...@@ -1062,9 +1053,6 @@ static int ideapad_backlight_update_status(struct backlight_device *blightdev) ...@@ -1062,9 +1053,6 @@ static int ideapad_backlight_update_status(struct backlight_device *blightdev)
{ {
struct ideapad_private *priv = bl_get_data(blightdev); struct ideapad_private *priv = bl_get_data(blightdev);
if (!priv)
return -EINVAL;
if (write_ec_cmd(priv->adev->handle, VPCCMD_W_BL, if (write_ec_cmd(priv->adev->handle, VPCCMD_W_BL,
blightdev->props.brightness)) blightdev->props.brightness))
return -EIO; return -EIO;
...@@ -1374,13 +1362,9 @@ static int ideapad_acpi_remove(struct platform_device *pdev) ...@@ -1374,13 +1362,9 @@ static int ideapad_acpi_remove(struct platform_device *pdev)
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int ideapad_acpi_resume(struct device *device) static int ideapad_acpi_resume(struct device *dev)
{ {
struct ideapad_private *priv; struct ideapad_private *priv = dev_get_drvdata(dev);
if (!device)
return -EINVAL;
priv = dev_get_drvdata(device);
ideapad_sync_rfk_state(priv); ideapad_sync_rfk_state(priv);
ideapad_sync_touchpad_state(priv); ideapad_sync_touchpad_state(priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment