From: Dan Carpenter Date: Thu, 19 Apr 2018 10:05:49 +0000 (+0300) Subject: PCI: ibmphp: Fix use-before-set in get_max_bus_speed() X-Git-Tag: v4.19~864^2~19^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4051f5ebb11c6ef4b0d3eac2fbbd187c070656c5;p=platform%2Fkernel%2Flinux-rpi3.git PCI: ibmphp: Fix use-before-set in get_max_bus_speed() The "rc" variable is only initialized on the error path. The caller doesn't check the return but, if "rc" is non-zero, then this function is basically a no-op. Fixes: 3749c51ac6c1 ("PCI: Make current and maximum bus speeds part of the PCI core") Signed-off-by: Dan Carpenter Signed-off-by: Bjorn Helgaas --- diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index b81ca3f..1869b04 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c @@ -379,7 +379,7 @@ static int get_adapter_present(struct hotplug_slot *hotplug_slot, u8 *value) static int get_max_bus_speed(struct slot *slot) { - int rc; + int rc = 0; u8 mode = 0; enum pci_bus_speed speed; struct pci_bus *bus = slot->hotplug_slot->pci_slot->bus;