aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-09-22 22:04:54 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-22 22:04:54 -0400
commit4d5392cc4de3403d71b929f39f3bc659db029ad1 (patch)
tree42d7deba9115f39fb804beca674310c20e9cfb07 /drivers
parent2cdc55751c33829f00510e0104562d0f8d8a9b85 (diff)
drivers/isdn/capi/kcapi.c: Adjust error handling code involving capi_ctr_put
After calling capi_ctr_get, error handling code should call capi_ctr_put. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @r@ expression x,E; statement S; position p1,p2,p3; @@ ( if ((x = capi_ctr_get@p1(...)) == NULL || ...) S | x = capi_ctr_get@p1(...) ... when != x if (x == NULL || ...) S ) <... if@p3 (...) { ... when != capi_ctr_put(x) when != if (x) { ... capi_ctr_put(x); ...} return@p2 ...; } ...> ( return x; | return 0; | x = E | E = x | capi_ctr_put(x) ) @exists@ position r.p1,r.p2,r.p3; expression x; int ret != 0; statement S; @@ * x = capi_ctr_get@p1(...) <... * if@p3 (...) S ...> * return@p2 \(NULL\|ret\); // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/isdn/capi/kcapi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index 75726ea0fbbd..5360c4fd4739 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -828,15 +828,18 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
828 return -ESRCH; 828 return -ESRCH;
829 if (card->load_firmware == NULL) { 829 if (card->load_firmware == NULL) {
830 printk(KERN_DEBUG "kcapi: load: no load function\n"); 830 printk(KERN_DEBUG "kcapi: load: no load function\n");
831 capi_ctr_put(card);
831 return -ESRCH; 832 return -ESRCH;
832 } 833 }
833 834
834 if (ldef.t4file.len <= 0) { 835 if (ldef.t4file.len <= 0) {
835 printk(KERN_DEBUG "kcapi: load: invalid parameter: length of t4file is %d ?\n", ldef.t4file.len); 836 printk(KERN_DEBUG "kcapi: load: invalid parameter: length of t4file is %d ?\n", ldef.t4file.len);
837 capi_ctr_put(card);
836 return -EINVAL; 838 return -EINVAL;
837 } 839 }
838 if (ldef.t4file.data == NULL) { 840 if (ldef.t4file.data == NULL) {
839 printk(KERN_DEBUG "kcapi: load: invalid parameter: dataptr is 0\n"); 841 printk(KERN_DEBUG "kcapi: load: invalid parameter: dataptr is 0\n");
842 capi_ctr_put(card);
840 return -EINVAL; 843 return -EINVAL;
841 } 844 }
842 845
@@ -849,6 +852,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
849 852
850 if (card->cardstate != CARD_DETECTED) { 853 if (card->cardstate != CARD_DETECTED) {
851 printk(KERN_INFO "kcapi: load: contr=%d not in detect state\n", ldef.contr); 854 printk(KERN_INFO "kcapi: load: contr=%d not in detect state\n", ldef.contr);
855 capi_ctr_put(card);
852 return -EBUSY; 856 return -EBUSY;
853 } 857 }
854 card->cardstate = CARD_LOADING; 858 card->cardstate = CARD_LOADING;