tegra: gpio: fix null label regression
authorMarcel Ziswiler <marcel@ziswiler.com>
Fri, 10 Oct 2014 14:56:50 +0000 (16:56 +0200)
committerTom Warren <twarren@nvidia.com>
Wed, 22 Oct 2014 16:30:55 +0000 (09:30 -0700)
Fix Tegra GPIO driver to not crash resp. misbehave upon requesting
GPIOs with an empty aka NULL label. As the driver uses exclusively the
label to check for reservation status actually supplying one is
mandatory!

This fixes a regression introduced by commit:

2fccd2d96badcdf6165658a99771a4c475586279
tegra: Convert tegra GPIO driver to use driver model

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
drivers/gpio/tegra_gpio.c

index 1cc4abb8a938b16ccc1322a6adcc903bc064b299..70663fc4decbba156cd93e527072df76d6ea4d1d 100644 (file)
@@ -171,6 +171,9 @@ static int tegra_gpio_request(struct udevice *dev, unsigned offset,
 {
        struct tegra_port_info *state = dev_get_priv(dev);
 
+       if (!label)
+               return -EINVAL;
+
        if (*state->label[offset])
                return -EBUSY;