* [PATCH 1/3] pcmcia: m32r_pcc: check return from request_irq
@ 2016-09-18 22:21 Sudip Mukherjee
2016-09-18 22:21 ` [PATCH 2/3] pcmcia: m32r_pcc: use common error path Sudip Mukherjee
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2016-09-18 22:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, linux-pcmcia, Sudip Mukherjee
While building m32r allmodconfig we were getting warning:
drivers/pcmcia/m32r_pcc.c:331:2:
warning: ignoring return value of 'request_irq',
declared with attribute warn_unused_result
request_irq() can fail and we should always be checking the result from
it. Check the result and return it to the caller.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
m32r allmodconfig build log is at:
https://travis-ci.org/sudipm-mukherjee/parport/jobs/160355863
drivers/pcmcia/m32r_pcc.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
index eb126b9..fad4455 100644
--- a/drivers/pcmcia/m32r_pcc.c
+++ b/drivers/pcmcia/m32r_pcc.c
@@ -296,10 +296,11 @@ static int __init is_alive(u_short sock)
return 0;
}
-static void add_pcc_socket(ulong base, int irq, ulong mapaddr,
- unsigned int ioaddr)
+static int add_pcc_socket(ulong base, int irq, ulong mapaddr,
+ unsigned int ioaddr)
{
pcc_socket_t *t = &socket[pcc_sockets];
+ int err;
/* add sockets */
t->ioaddr = ioaddr;
@@ -328,11 +329,16 @@ static void add_pcc_socket(ulong base, int irq, ulong mapaddr,
t->socket.irq_mask = 0;
t->socket.pci_irq = 2 + pcc_sockets; /* XXX */
- request_irq(irq, pcc_interrupt, 0, "m32r-pcc", pcc_interrupt);
+ err = request_irq(irq, pcc_interrupt, 0, "m32r-pcc", pcc_interrupt);
+ if (err) {
+ if (t->base > 0)
+ release_region(t->base, 0x20);
+ return err;
+ }
pcc_sockets++;
- return;
+ return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] pcmcia: m32r_pcc: use common error path
2016-09-18 22:21 [PATCH 1/3] pcmcia: m32r_pcc: check return from request_irq Sudip Mukherjee
@ 2016-09-18 22:21 ` Sudip Mukherjee
2016-09-18 22:21 ` [PATCH 3/3] pcmcia: m32r_pcc: check return from add_pcc_socket Sudip Mukherjee
2016-11-13 21:27 ` [PATCH 1/3] pcmcia: m32r_pcc: check return from request_irq Sudip Mukherjee
2 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2016-09-18 22:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, linux-pcmcia, Sudip Mukherjee
Use a common error path for the failure.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
drivers/pcmcia/m32r_pcc.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
index fad4455..56bf388 100644
--- a/drivers/pcmcia/m32r_pcc.c
+++ b/drivers/pcmcia/m32r_pcc.c
@@ -689,10 +689,8 @@ static int __init init_m32r_pcc(void)
return ret;
ret = platform_device_register(&pcc_device);
- if (ret){
- platform_driver_unregister(&pcc_driver);
- return ret;
- }
+ if (ret)
+ goto unreg_driv;
printk(KERN_INFO "m32r PCC probe:\n");
@@ -706,9 +704,8 @@ static int __init init_m32r_pcc(void)
if (pcc_sockets == 0) {
printk("socket is not found.\n");
- platform_device_unregister(&pcc_device);
- platform_driver_unregister(&pcc_driver);
- return -ENODEV;
+ ret = -ENODEV;
+ goto unreg_dev;
}
/* Set up interrupt handler(s) */
@@ -734,6 +731,12 @@ static int __init init_m32r_pcc(void)
}
return 0;
+
+unreg_dev:
+ platform_device_unregister(&pcc_device);
+unreg_driv:
+ platform_driver_unregister(&pcc_driver);
+ return ret;
} /* init_m32r_pcc */
static void __exit exit_m32r_pcc(void)
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] pcmcia: m32r_pcc: check return from add_pcc_socket
2016-09-18 22:21 [PATCH 1/3] pcmcia: m32r_pcc: check return from request_irq Sudip Mukherjee
2016-09-18 22:21 ` [PATCH 2/3] pcmcia: m32r_pcc: use common error path Sudip Mukherjee
@ 2016-09-18 22:21 ` Sudip Mukherjee
2016-11-13 21:27 ` [PATCH 1/3] pcmcia: m32r_pcc: check return from request_irq Sudip Mukherjee
2 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2016-09-18 22:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, linux-pcmcia, Sudip Mukherjee
If request_irq() fails it passes the error to the caller. The caller
now checks it and jumps to the common error path on failure.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
drivers/pcmcia/m32r_pcc.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
index 56bf388..e50bbf8 100644
--- a/drivers/pcmcia/m32r_pcc.c
+++ b/drivers/pcmcia/m32r_pcc.c
@@ -696,10 +696,16 @@ static int __init init_m32r_pcc(void)
pcc_sockets = 0;
- add_pcc_socket(M32R_PCC0_BASE, PCC0_IRQ, M32R_PCC0_MAPBASE, 0x1000);
+ ret = add_pcc_socket(M32R_PCC0_BASE, PCC0_IRQ, M32R_PCC0_MAPBASE,
+ 0x1000);
+ if (ret)
+ goto unreg_dev;
#ifdef CONFIG_M32RPCC_SLOT2
- add_pcc_socket(M32R_PCC1_BASE, PCC1_IRQ, M32R_PCC1_MAPBASE, 0x2000);
+ ret = add_pcc_socket(M32R_PCC1_BASE, PCC1_IRQ, M32R_PCC1_MAPBASE,
+ 0x2000);
+ if (ret)
+ goto unreg_dev;
#endif
if (pcc_sockets == 0) {
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] pcmcia: m32r_pcc: check return from request_irq
2016-09-18 22:21 [PATCH 1/3] pcmcia: m32r_pcc: check return from request_irq Sudip Mukherjee
2016-09-18 22:21 ` [PATCH 2/3] pcmcia: m32r_pcc: use common error path Sudip Mukherjee
2016-09-18 22:21 ` [PATCH 3/3] pcmcia: m32r_pcc: check return from add_pcc_socket Sudip Mukherjee
@ 2016-11-13 21:27 ` Sudip Mukherjee
2 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2016-11-13 21:27 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, linux-pcmcia
On Sunday 18 September 2016 11:21 PM, Sudip Mukherjee wrote:
> While building m32r allmodconfig we were getting warning:
>
> drivers/pcmcia/m32r_pcc.c:331:2:
> warning: ignoring return value of 'request_irq',
> declared with attribute warn_unused_result
>
> request_irq() can fail and we should always be checking the result from
> it. Check the result and return it to the caller.
>
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
Hi Andrew,
A gentle ping.
Regards
Sudip
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-13 21:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-18 22:21 [PATCH 1/3] pcmcia: m32r_pcc: check return from request_irq Sudip Mukherjee
2016-09-18 22:21 ` [PATCH 2/3] pcmcia: m32r_pcc: use common error path Sudip Mukherjee
2016-09-18 22:21 ` [PATCH 3/3] pcmcia: m32r_pcc: check return from add_pcc_socket Sudip Mukherjee
2016-11-13 21:27 ` [PATCH 1/3] pcmcia: m32r_pcc: check return from request_irq Sudip Mukherjee
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.