summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorBarnabás Pőcze <pobrn@protonmail.com>2021-02-03 21:54:23 +0000
committerHans de Goede <hdegoede@redhat.com>2021-02-04 10:20:10 +0100
commite1a39a4460c17fa397020cd064744a908e2eac71 (patch)
tree6ec2de9986503621905e57d3053daa7dfdc3d632 /drivers/platform
parenta14b3c83ab435e0a06f83a2c519ad27baf805cba (diff)
downloadlinux-e1a39a4460c17fa397020cd064744a908e2eac71.tar.bz2
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: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210203215403.290792-3-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/ideapad-laptop.c78
1 files changed, 31 insertions, 47 deletions
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 18c71e28ebc8..415d362a642a 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -264,9 +264,6 @@ static int debugfs_status_show(struct seq_file *s, void *data)
struct ideapad_private *priv = s->private;
unsigned long value;
- if (!priv)
- return -EINVAL;
-
if (!read_ec_data(priv->adev->handle, VPCCMD_R_BL_MAX, &value))
seq_printf(s, "Backlight max:\t%lu\n", 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)
{
struct ideapad_private *priv = s->private;
- if (!priv) {
- seq_printf(s, "cfg: N/A\n");
- } else {
- seq_printf(s, "cfg: 0x%.8lX\n\nCapability: ",
- priv->cfg);
- if (test_bit(CFG_BT_BIT, &priv->cfg))
- seq_printf(s, "Bluetooth ");
- if (test_bit(CFG_3G_BIT, &priv->cfg))
- seq_printf(s, "3G ");
- if (test_bit(CFG_WIFI_BIT, &priv->cfg))
- seq_printf(s, "Wireless ");
- if (test_bit(CFG_CAMERA_BIT, &priv->cfg))
- seq_printf(s, "Camera ");
- seq_printf(s, "\nGraphic: ");
- switch ((priv->cfg)&0x700) {
- case 0x100:
- seq_printf(s, "Intel");
- break;
- case 0x200:
- seq_printf(s, "ATI");
- break;
- case 0x300:
- seq_printf(s, "Nvidia");
- break;
- case 0x400:
- seq_printf(s, "Intel and ATI");
- break;
- case 0x500:
- seq_printf(s, "Intel and Nvidia");
- break;
- }
- seq_printf(s, "\n");
+ seq_printf(s, "cfg: 0x%.8lX\n\nCapability: ",
+ priv->cfg);
+ if (test_bit(CFG_BT_BIT, &priv->cfg))
+ seq_printf(s, "Bluetooth ");
+ if (test_bit(CFG_3G_BIT, &priv->cfg))
+ seq_printf(s, "3G ");
+ if (test_bit(CFG_WIFI_BIT, &priv->cfg))
+ seq_printf(s, "Wireless ");
+ if (test_bit(CFG_CAMERA_BIT, &priv->cfg))
+ seq_printf(s, "Camera ");
+ seq_printf(s, "\nGraphic: ");
+ switch ((priv->cfg)&0x700) {
+ case 0x100:
+ seq_printf(s, "Intel");
+ break;
+ case 0x200:
+ seq_printf(s, "ATI");
+ break;
+ case 0x300:
+ seq_printf(s, "Nvidia");
+ break;
+ case 0x400:
+ seq_printf(s, "Intel and ATI");
+ break;
+ case 0x500:
+ seq_printf(s, "Intel and Nvidia");
+ break;
}
+ seq_printf(s, "\n");
+
return 0;
}
DEFINE_SHOW_ATTRIBUTE(debugfs_cfg);
@@ -1050,9 +1044,6 @@ static int ideapad_backlight_get_brightness(struct backlight_device *blightdev)
struct ideapad_private *priv = bl_get_data(blightdev);
unsigned long now;
- if (!priv)
- return -EINVAL;
-
if (read_ec_data(priv->adev->handle, VPCCMD_R_BL, &now))
return -EIO;
return now;
@@ -1062,9 +1053,6 @@ static int ideapad_backlight_update_status(struct backlight_device *blightdev)
{
struct ideapad_private *priv = bl_get_data(blightdev);
- if (!priv)
- return -EINVAL;
-
if (write_ec_cmd(priv->adev->handle, VPCCMD_W_BL,
blightdev->props.brightness))
return -EIO;
@@ -1374,13 +1362,9 @@ static int ideapad_acpi_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM_SLEEP
-static int ideapad_acpi_resume(struct device *device)
+static int ideapad_acpi_resume(struct device *dev)
{
- struct ideapad_private *priv;
-
- if (!device)
- return -EINVAL;
- priv = dev_get_drvdata(device);
+ struct ideapad_private *priv = dev_get_drvdata(dev);
ideapad_sync_rfk_state(priv);
ideapad_sync_touchpad_state(priv);