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

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.com


Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent a14b3c83
Loading
Loading
Loading
Loading
+31 −47
Original line number Diff line number Diff line
@@ -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,9 +308,6 @@ 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))
@@ -343,7 +337,7 @@ static int debugfs_cfg_show(struct seq_file *s, void *data)
		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);