* [PATCH 1/2] tty: serial: Check return code of gpiochip_remove
@ 2012-08-18 16:12 Emil Goode
2012-08-18 16:12 ` [PATCH 2/2] tty: serial: Remove explicit use of devm_kfree Emil Goode
0 siblings, 1 reply; 2+ messages in thread
From: Emil Goode @ 2012-08-18 16:12 UTC (permalink / raw)
To: alan, gregkh; +Cc: linux-serial, linux-kernel, kernel-janitors, Emil Goode
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>
---
drivers/tty/serial/max310x.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 534e448..06ff5ad 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -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");
@@ -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);
@@ -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[] = {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] tty: serial: Remove explicit use of devm_kfree
2012-08-18 16:12 [PATCH 1/2] tty: serial: Check return code of gpiochip_remove Emil Goode
@ 2012-08-18 16:12 ` Emil Goode
0 siblings, 0 replies; 2+ messages in thread
From: Emil Goode @ 2012-08-18 16:12 UTC (permalink / raw)
To: alan, gregkh; +Cc: linux-serial, linux-kernel, kernel-janitors, Emil Goode
There is no reason to explicitly call devm_kfree
in probe or remove functions.
Signed-off-by: Emil Goode <emilgoode@gmail.com>
---
drivers/tty/serial/max310x.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 06ff5ad..2bc28a5 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1198,7 +1198,6 @@ err_freq:
err_out:
dev_set_drvdata(dev, NULL);
- devm_kfree(dev, s);
return ret;
}
@@ -1234,8 +1233,6 @@ static int __devexit max310x_remove(struct spi_device *spi)
if (s->pdata->exit)
s->pdata->exit();
- devm_kfree(dev, s);
-
return ret;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-18 16:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-18 16:12 [PATCH 1/2] tty: serial: Check return code of gpiochip_remove Emil Goode
2012-08-18 16:12 ` [PATCH 2/2] tty: serial: Remove explicit use of devm_kfree Emil Goode
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).