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)
commit5fcaa0051dfcc5fe77aee95061945d80e465a027
tree65c288fe27a7666e79d1ace4885df6546b1471cb
parentc1ae3cfa0e89fa1a7ecc4c99031f5e9ae99d9201
PCI: rockchip: Handle regulator_get_current_limit() failure correctly

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