]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
PCI: rockchip: Handle regulator_get_current_limit() failure correctly
authorBrian Norris <briannorris@chromium.org>
Fri, 10 Mar 2017 02:46:13 +0000 (18:46 -0800)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 23 Mar 2017 22:09:12 +0000 (17:09 -0500)
regulator_get_current_limit() can return negative error codes.  We saved
the return value in an unsigned "curr", and a subsequent check interpreted
a negative error code as a positive (invalid) current limit.

Save the return code as a signed value, which avoids messages like this,
seen on Samsung Chromebook Plus:

  rockchip-pcie f8000000.pcie: invalid power supply

[bhelgaas: changelog]
Fixes: 4816c4c7b82b ("PCI: rockchip: Provide captured slot power limit and scale")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Shawn Lin <shawn.lin@rock-chips.com>
drivers/pci/host/pcie-rockchip.c

index 26ddd3535272e89b9dcb9b1da48ee6acb6211666..d785f64ec03b68950dc6e5c34f983b2716b30fbc 100644 (file)
@@ -425,7 +425,8 @@ static struct pci_ops rockchip_pcie_ops = {
 
 static void rockchip_pcie_set_power_limit(struct rockchip_pcie *rockchip)
 {
-       u32 status, curr, scale, power;
+       int curr;
+       u32 status, scale, power;
 
        if (IS_ERR(rockchip->vpcie3v3))
                return;