Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mei: gsc: remove unnecessary NULL pointer checks

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>

authored by

Bjorn Helgaas and committed by
Greg Kroah-Hartman
d6543805 e0014ce7

-17
-17
drivers/misc/mei/gsc-me.c
··· 144 144 struct mei_me_hw *hw; 145 145 146 146 dev = dev_get_drvdata(&aux_dev->dev); 147 - if (!dev) 148 - return; 149 - 150 147 hw = to_me_hw(dev); 151 148 152 149 mei_stop(dev); ··· 165 168 { 166 169 struct mei_device *dev = dev_get_drvdata(device); 167 170 168 - if (!dev) 169 - return -ENODEV; 170 - 171 171 mei_stop(dev); 172 172 173 173 mei_disable_interrupts(dev); ··· 179 185 struct mei_aux_device *adev; 180 186 int err; 181 187 struct mei_me_hw *hw; 182 - 183 - if (!dev) 184 - return -ENODEV; 185 188 186 189 hw = to_me_hw(dev); 187 190 aux_dev = to_auxiliary_dev(device); ··· 202 211 { 203 212 struct mei_device *dev = dev_get_drvdata(device); 204 213 205 - if (!dev) 206 - return -ENODEV; 207 214 if (mei_write_is_idle(dev)) 208 215 pm_runtime_autosuspend(device); 209 216 ··· 213 224 struct mei_device *dev = dev_get_drvdata(device); 214 225 struct mei_me_hw *hw; 215 226 int ret; 216 - 217 - if (!dev) 218 - return -ENODEV; 219 227 220 228 mutex_lock(&dev->device_lock); 221 229 ··· 237 251 struct mei_device *dev = dev_get_drvdata(device); 238 252 struct mei_me_hw *hw; 239 253 irqreturn_t irq_ret; 240 - 241 - if (!dev) 242 - return -ENODEV; 243 254 244 255 mutex_lock(&dev->device_lock); 245 256