summaryrefslogtreecommitdiff
path: root/drivers/dahdi/dahdi-base.c
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-01-03 18:27:31 +0000
committerShaun Ruffell <sruffell@digium.com>2011-01-03 18:27:31 +0000
commit8dba5fc03cf032f6274eb7d36f3fc6d6a365e450 (patch)
tree89da4ce08cc412fa8263d27f63d28de5341ab865 /drivers/dahdi/dahdi-base.c
parent3460880a788b18a2cde8268d458578e1d5589e56 (diff)
dahdi: Use 'dacs_chan' convenience pointer in dahdi_ioctl_chanconfig.
Eliminates the need to look for the channel number twice. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Acked-by: Kinsey Moore <kmoore@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9599 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/dahdi-base.c')
-rw-r--r--drivers/dahdi/dahdi-base.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index 3376acc..5eeb2a5 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -4284,6 +4284,7 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data)
struct dahdi_chanconfig ch;
struct dahdi_chan *newmaster;
struct dahdi_chan *chan;
+ struct dahdi_chan *dacs_chan = NULL;
unsigned long flags;
int sigcap;
@@ -4301,7 +4302,8 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data)
ch.sigtype = newmaster->sig;
} else if ((ch.sigtype & __DAHDI_SIG_DACS) == __DAHDI_SIG_DACS) {
newmaster = chan;
- if (!chan_from_num(ch.idlebits))
+ dacs_chan = chan_from_num(ch.idlebits);
+ if (!dacs_chan)
return -EINVAL;
} else {
newmaster = chan;
@@ -4378,10 +4380,14 @@ static int dahdi_ioctl_chanconfig(struct file *file, unsigned long data)
chan->flags &= ~DAHDI_FLAG_FCS;
}
if ((ch.sigtype & __DAHDI_SIG_DACS) == __DAHDI_SIG_DACS) {
+ if (unlikely(!dacs_chan)) {
+ spin_unlock_irqrestore(&chan->lock, flags);
+ return -EINVAL;
+ }
/* Setup conference properly */
chan->confmode = DAHDI_CONF_DIGITALMON;
chan->confna = ch.idlebits;
- res = dahdi_chan_dacs(chan, chan_from_num(ch.idlebits));
+ res = dahdi_chan_dacs(chan, dacs_chan);
} else {
dahdi_disable_dacs(chan);
}