]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
isdn/capi: make reset_ctr op truly optional
authorTilman Schmidt <tilman@imap.cc>
Sun, 23 May 2010 01:02:08 +0000 (01:02 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 2 Aug 2010 17:30:09 +0000 (10:30 -0700)
commit 85a83560afa69862639fb2d6f670b4440a003335 upstream.

The CAPI controller operation reset_ctr is marked as optional, and
not all drivers do implement it. Add a check to the kernel CAPI
whether it exists before trying to call it.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Acked-by: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/isdn/capi/kcapi.c

index bd00dceacaf0d6cac10a1ab8da423264f706a313..bde3c88b8b270e0ca527849b0f58c9647bfb67ad 100644 (file)
@@ -1147,6 +1147,12 @@ load_unlock_out:
                if (ctr->state == CAPI_CTR_DETECTED)
                        goto reset_unlock_out;
 
+               if (ctr->reset_ctr == NULL) {
+                       printk(KERN_DEBUG "kcapi: reset: no reset function\n");
+                       retval = -ESRCH;
+                       goto reset_unlock_out;
+               }
+
                ctr->reset_ctr(ctr);
 
                retval = wait_on_ctr_state(ctr, CAPI_CTR_DETECTED);