From e8221c04cf0ade614886c7e6c9adc9b3ef239a53 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 2 Jun 2011 20:01:10 +0000 Subject: [PATCH] dahdi: Propagate shutdown returncode to user space. This change fixes a condition where 'dahdi_cfg -s' would always return success regardless of whether a board driver was able to complete the shutdown. Only impacts board drivers that implemented the shutdown span callback. Signed-off-by: Shaun Ruffell Acked-by: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9935 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 9b83025..fac7d28 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -4754,7 +4754,6 @@ static int dahdi_ioctl_shutdown(unsigned long data) { /* I/O CTL's for control interface */ int j; - int res = 0; int x; struct dahdi_span *s; @@ -4768,8 +4767,14 @@ static int dahdi_ioctl_shutdown(unsigned long data) for (x = 0; x < s->channels; x++) s->chans[x]->sig = 0; - if (s->ops->shutdown) - res = s->ops->shutdown(s); + if (s->ops->shutdown) { + int res = s->ops->shutdown(s); + if (res) { + put_span(s); + return res; + } + } + s->flags &= ~DAHDI_FLAG_RUNNING; put_span(s); return 0;