From 3998c8fd1174f4685ccab56ffd8afc8340e2292d Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 26 Oct 2011 18:57:07 +0000 Subject: [PATCH] dahdi: Add error messages in dahdi_ioctl_chanconfig. Provide more context to trouble shoot failures. Signed-off-by: Tzafrir Cohen Acked-by: Shaun Ruffell git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10271 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 5712482..37463a9 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -4466,19 +4466,28 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data) return -EFAULT; chan = chan_from_num(ch.chan); - if (!chan) + if (!chan) { + printk(KERN_NOTICE "%s: No channel for number %d\n", + __func__, ch.chan); return -EINVAL; + } if (ch.sigtype == DAHDI_SIG_SLAVE) { newmaster = chan_from_num(ch.master); - if (!newmaster) + if (!newmaster) { + chan_notice(chan, "%s: slave channel without master.\n", + __func__); return -EINVAL; + } ch.sigtype = newmaster->sig; } else if ((ch.sigtype & __DAHDI_SIG_DACS) == __DAHDI_SIG_DACS) { newmaster = chan; dacs_chan = chan_from_num(ch.idlebits); - if (!dacs_chan) + if (!dacs_chan) { + chan_notice(chan, "%s: dacs channel not found: %d.\n", + __func__, ch.idlebits); return -EINVAL; + } } else { newmaster = chan; } @@ -4511,8 +4520,13 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data) if (sigcap & DAHDI_SIG_CLEAR) sigcap |= (DAHDI_SIG_HDLCRAW | DAHDI_SIG_HDLCFCS | DAHDI_SIG_HDLCNET | DAHDI_SIG_DACS); - if ((sigcap & ch.sigtype) != ch.sigtype) + if ((sigcap & ch.sigtype) != ch.sigtype) { + if (debug) { + chan_notice(chan, "%s: bad sigtype. sigcap: %x, sigtype: %x.\n", + __func__, sigcap, ch.sigtype); + } res = -EINVAL; + } if (chan->master != chan) { struct dahdi_chan *oldmaster = chan->master; @@ -4556,6 +4570,8 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data) if ((ch.sigtype & __DAHDI_SIG_DACS) == __DAHDI_SIG_DACS) { if (unlikely(!dacs_chan)) { spin_unlock_irqrestore(&chan->lock, flags); + chan_notice(chan, "%s: dacs but no dacs_chan\n", + __func__); return -EINVAL; } /* Setup conference properly */