Skip to content

Commit

Permalink
tty: serial: max310x: Check return code of gpiochip_remove
Browse files Browse the repository at this point in the history
The gpiochip_remove function may fail to remove a gpio_chip
if any GPIOs are still requested. This patch informs the caller
of such a senario.

Sparse is warning because the function prototype has a
__must_check annotation.

Sparse warning:
drivers/tty/serial/max310x.c:1223:18: warning:
	ignoring return value of ‘gpiochip_remove’,
	declared with attribute warn_unused_result
	[-Wunused-result]

Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Emil Goode authored and Greg Kroah-Hartman committed Sep 5, 2012
1 parent 1a16afa commit 23e7c6a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/tty/serial/max310x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,7 @@ static int __devexit max310x_remove(struct spi_device *spi)
{
struct device *dev = &spi->dev;
struct max310x_port *s = dev_get_drvdata(dev);
int ret = 0;

dev_dbg(dev, "Removing port\n");

Expand All @@ -1219,8 +1220,11 @@ static int __devexit max310x_remove(struct spi_device *spi)
uart_unregister_driver(&s->uart);

#ifdef CONFIG_GPIOLIB
if (s->pdata->gpio_base)
gpiochip_remove(&s->gpio);
if (s->pdata->gpio_base) {
ret = gpiochip_remove(&s->gpio);
if (ret)
dev_err(dev, "Failed to remove gpio chip: %d\n", ret);
}
#endif

dev_set_drvdata(dev, NULL);
Expand All @@ -1232,7 +1236,7 @@ static int __devexit max310x_remove(struct spi_device *spi)

devm_kfree(dev, s);

return 0;
return ret;
}

static const struct spi_device_id max310x_id_table[] = {
Expand Down

0 comments on commit 23e7c6a

Please sign in to comment.