Skip to content

Commit

Permalink
Merge tag 'gpio-v4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
 "Here are two GPIO fixes for the v4.6 series, both in drivers:

   - Prevent NULL dereference in the Xgene driver
   - Fix an uninitialized spinlock in the menz127 driver"

* tag 'gpio-v4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpio: xgene: Prevent NULL pointer dereference
  gpio: menz127: Drop lock field from struct men_z127_gpio
  • Loading branch information
Linus Torvalds committed Mar 31, 2016
2 parents c5bce40 + 8d8ee18 commit ca45720
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/gpio/gpio-menz127.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ struct men_z127_gpio {
void __iomem *reg_base;
struct mcb_device *mdev;
struct resource *mem;
spinlock_t lock;
};

static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio,
Expand Down Expand Up @@ -69,7 +68,7 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio,
debounce /= 50;
}

spin_lock(&priv->lock);
spin_lock(&gc->bgpio_lock);

db_en = readl(priv->reg_base + MEN_Z127_DBER);

Expand All @@ -84,7 +83,7 @@ static int men_z127_debounce(struct gpio_chip *gc, unsigned gpio,
writel(db_en, priv->reg_base + MEN_Z127_DBER);
writel(db_cnt, priv->reg_base + GPIO_TO_DBCNT_REG(gpio));

spin_unlock(&priv->lock);
spin_unlock(&gc->bgpio_lock);

return 0;
}
Expand All @@ -97,7 +96,7 @@ static int men_z127_request(struct gpio_chip *gc, unsigned gpio_pin)
if (gpio_pin >= gc->ngpio)
return -EINVAL;

spin_lock(&priv->lock);
spin_lock(&gc->bgpio_lock);
od_en = readl(priv->reg_base + MEN_Z127_ODER);

if (gpiochip_line_is_open_drain(gc, gpio_pin))
Expand All @@ -106,7 +105,7 @@ static int men_z127_request(struct gpio_chip *gc, unsigned gpio_pin)
od_en &= ~BIT(gpio_pin);

writel(od_en, priv->reg_base + MEN_Z127_ODER);
spin_unlock(&priv->lock);
spin_unlock(&gc->bgpio_lock);

return 0;
}
Expand Down
5 changes: 5 additions & 0 deletions drivers/gpio/gpio-xgene.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ static int xgene_gpio_probe(struct platform_device *pdev)
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
err = -EINVAL;
goto err;
}

gpio->base = devm_ioremap_nocache(&pdev->dev, res->start,
resource_size(res));
if (!gpio->base) {
Expand Down

0 comments on commit ca45720

Please sign in to comment.