Skip to content

Commit

Permalink
PCI: pciehp: Drop unnecessary NULL pointer check
Browse files Browse the repository at this point in the history
pciehp_disable_slot() checks if the ctrl attribute of the slot is NULL
and bails out if so.  However the function is not called prior to the
attribute being set in pcie_init_slot(), and pcie_init_slot() is not
called if ctrl is NULL.  So the check is unnecessary.  Drop it.

It has been present ever since the driver was introduced in 2004, but it
was already unnecessary back then:
https://git.kernel.org/tglx/history/c/c16b4b14d980

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  • Loading branch information
Lukas Wunner authored and Bjorn Helgaas committed Jul 23, 2018
1 parent 1204e35 commit 6641311
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions drivers/pci/hotplug/pciehp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,6 @@ int pciehp_disable_slot(struct slot *p_slot)
u8 getstatus = 0;
struct controller *ctrl = p_slot->ctrl;

if (!p_slot->ctrl)
return 1;

if (POWER_CTRL(p_slot->ctrl)) {
pciehp_get_power_status(p_slot, &getstatus);
if (!getstatus) {
Expand Down

0 comments on commit 6641311

Please sign in to comment.