PCI: hotplug: Drop superfluous NULL pointer checks in has_*_file()
authorLukas Wunner <lukas@wunner.de>
Tue, 25 Feb 2025 17:06:03 +0000 (18:06 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 4 Mar 2025 23:00:12 +0000 (17:00 -0600)
commit62460bcb5a2ac37bb416aada0167db3fe78ac385
tree368e07466836fa0926de70ac53789cc7383a9b1a
parent666550a8066a5333ddc96ca2fd28cb49318e789e
PCI: hotplug: Drop superfluous NULL pointer checks in has_*_file()

The PCI hotplug core contains five has_*_file() functions to determine
whether a certain sysfs file shall be added (or removed) for a given
hotplug slot.

The functions perform NULL pointer checks for the hotplug_slot and its
hotplug_slot_ops.  However the callers already perform these checks:

  pci_hp_register()
    __pci_hp_register()
      __pci_hp_initialize()

  pci_hp_deregister()
    pci_hp_del()

The only way to actually trigger these checks is to call pci_hp_add()
without having called pci_hp_initialize().

Amend pci_hp_add() to catch that and drop the now superfluous NULL
pointer checks in has_*_file().

Drop the same superfluous checks from pci_hp_create_module_link(),
which is (only) called from pci_hp_add().

Link: https://lore.kernel.org/r/37d1928edf8c3201a8b10794f1db3142e16e02b9.1740501868.git.lukas@wunner.de
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/hotplug/pci_hotplug_core.c
drivers/pci/slot.c