From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tilman Schmidt Subject: [PATCH 1/2] isdn/capi: make reset_ctr op truly optional Date: Sun, 23 May 2010 03:15:13 +0200 (CEST) Message-ID: <20100523-patch-gigaset-01.tilman@imap.cc> References: <20100523-patch-gigaset-00.tilman@imap.cc> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Karsten Keil , Hansjoerg Lipp , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, i4ldeveloper-JX7+OpRa80SjiSfgN6Y1Ib39b6g2fGNp@public.gmane.org To: Karsten Keil , David Miller Return-path: In-Reply-To: <20100523-patch-gigaset-00.tilman-ZTO5kqT2PaM@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: i4ldeveloper-bounces-JX7+OpRa80SjiSfgN6Y1Ib39b6g2fGNp@public.gmane.org Errors-To: i4ldeveloper-bounces-JX7+OpRa80SjiSfgN6Y1Ib39b6g2fGNp@public.gmane.org List-Id: netdev.vger.kernel.org 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. Impact: oops prevention Signed-off-by: Tilman Schmidt --- drivers/isdn/capi/kcapi.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c index bd00dce..bde3c88 100644 --- a/drivers/isdn/capi/kcapi.c +++ b/drivers/isdn/capi/kcapi.c @@ -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); -- 1.6.5.3.298.g39add