Skip to content

Commit

Permalink
mei: gsc: remove unnecessary NULL pointer checks
Browse files Browse the repository at this point in the history
The .remove() and power management callbacks are never called unless
.probe() has already returned success, which means it has set drvdata to a
non-NULL pointer, so "dev" can never be NULL in the other callbacks.

Remove the unnecessary checks.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20240229181300.352077-2-helgaas@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Bjorn Helgaas authored and Greg Kroah-Hartman committed Mar 5, 2024
1 parent e0014ce commit d654380
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions drivers/misc/mei/gsc-me.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ static void mei_gsc_remove(struct auxiliary_device *aux_dev)
struct mei_me_hw *hw;

dev = dev_get_drvdata(&aux_dev->dev);
if (!dev)
return;

hw = to_me_hw(dev);

mei_stop(dev);
Expand All @@ -168,9 +165,6 @@ static int __maybe_unused mei_gsc_pm_suspend(struct device *device)
{
struct mei_device *dev = dev_get_drvdata(device);

if (!dev)
return -ENODEV;

mei_stop(dev);

mei_disable_interrupts(dev);
Expand All @@ -186,9 +180,6 @@ static int __maybe_unused mei_gsc_pm_resume(struct device *device)
int err;
struct mei_me_hw *hw;

if (!dev)
return -ENODEV;

hw = to_me_hw(dev);
aux_dev = to_auxiliary_dev(device);
adev = auxiliary_dev_to_mei_aux_dev(aux_dev);
Expand All @@ -211,8 +202,6 @@ static int __maybe_unused mei_gsc_pm_runtime_idle(struct device *device)
{
struct mei_device *dev = dev_get_drvdata(device);

if (!dev)
return -ENODEV;
if (mei_write_is_idle(dev))
pm_runtime_autosuspend(device);

Expand All @@ -225,9 +214,6 @@ static int __maybe_unused mei_gsc_pm_runtime_suspend(struct device *device)
struct mei_me_hw *hw;
int ret;

if (!dev)
return -ENODEV;

mutex_lock(&dev->device_lock);

if (mei_write_is_idle(dev)) {
Expand All @@ -252,9 +238,6 @@ static int __maybe_unused mei_gsc_pm_runtime_resume(struct device *device)
struct mei_me_hw *hw;
irqreturn_t irq_ret;

if (!dev)
return -ENODEV;

mutex_lock(&dev->device_lock);

hw = to_me_hw(dev);
Expand Down

0 comments on commit d654380

Please sign in to comment.