dahdi-linux: add multiple patch fixing compilation warning

Add multiple patch fixing compilation warning and obvius code bug.
Signed-off-by: NChristian Marangi <ansuelsmth@gmail.com>
上级 f265a939
From f9bc391e1cd830c830b3b4fb5fd46a59b41de373 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:18:13 +0200
Subject: [PATCH 1/6] dahdi: use fallthrough where needed
Use fallthrough instead of comment to fix compilation warning.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/dahdi-base.c | 14 +++++++-------
drivers/dahdi/wcaxx-base.c | 2 ++
drivers/dahdi/wctdm24xxp/base.c | 2 ++
drivers/dahdi/xpp/card_global.c | 2 +-
4 files changed, 12 insertions(+), 8 deletions(-)
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -7921,7 +7921,7 @@ static inline void __dahdi_process_getau
memset(getlin, 0, DAHDI_CHUNKSIZE * sizeof(short));
txb[0] = DAHDI_LIN2X(0, ms);
memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1);
- /* fall through to normal conf mode */
+ fallthrough;
case DAHDI_CONF_CONF: /* Normal conference mode */
if (is_pseudo_chan(ms)) /* if pseudo-channel */
{
@@ -7945,7 +7945,7 @@ static inline void __dahdi_process_getau
memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1);
break;
}
- /* fall through */
+ fallthrough;
case DAHDI_CONF_CONFMON: /* Conference monitor mode */
if (ms->confmode & DAHDI_CONF_LISTENER) {
/* Subtract out last sample written to conf */
@@ -8484,7 +8484,7 @@ static void __dahdi_hooksig_pvt(struct d
break;
}
#endif
- /* fall through intentionally */
+ fallthrough;
case DAHDI_SIG_FXSGS: /* FXS Groundstart */
if (rxsig == DAHDI_RXSIG_ONHOOK) {
chan->ringdebtimer = RING_DEBOUNCE_TIME;
@@ -8503,7 +8503,7 @@ static void __dahdi_hooksig_pvt(struct d
chan->gotgs = 1;
}
}
- /* fall through intentionally */
+ fallthrough;
case DAHDI_SIG_FXOLS: /* FXO Loopstart */
case DAHDI_SIG_FXOKS: /* FXO Kewlstart */
switch(rxsig) {
@@ -8603,7 +8603,7 @@ void dahdi_rbsbits(struct dahdi_chan *ch
__dahdi_hooksig_pvt(chan, DAHDI_RXSIG_START);
break;
}
- /* Fall through */
+ fallthrough;
case DAHDI_SIG_EM_E1:
case DAHDI_SIG_FXOLS: /* FXO Loopstart */
case DAHDI_SIG_FXOKS: /* FXO Kewlstart */
@@ -8621,7 +8621,7 @@ void dahdi_rbsbits(struct dahdi_chan *ch
break;
case DAHDI_SIG_FXSKS: /* FXS Kewlstart */
case DAHDI_SIG_FXSGS: /* FXS Groundstart */
- /* Fall through */
+ fallthrough;
case DAHDI_SIG_FXSLS:
if (!(cursig & DAHDI_BBIT)) {
/* Check for ringing first */
@@ -9050,7 +9050,7 @@ static inline void __dahdi_process_putau
memcpy(ss->putlin, putlin, DAHDI_CHUNKSIZE * sizeof(short));
break;
}
- /* fall through */
+ fallthrough;
case DAHDI_CONF_CONFANN: /* Conference with announce */
if (ms->confmode & DAHDI_CONF_TALKER) {
/* Store temp value */
--- a/drivers/dahdi/wcaxx-base.c
+++ b/drivers/dahdi/wcaxx-base.c
@@ -1446,6 +1446,7 @@ wcaxx_check_battery_lost(struct wcaxx *w
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK);
+ fallthrough;
case BATTERY_PRESENT:
fxo->battery_state = BATTERY_DEBOUNCING_LOST;
fxo->battdebounce_timer = wc->framecount + battdebounce;
@@ -1554,6 +1555,7 @@ wcaxx_check_battery_present(struct wcaxx
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK);
+ fallthrough;
case BATTERY_LOST: /* intentional drop through */
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
fxo->battdebounce_timer = wc->framecount + battdebounce;
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -1955,6 +1955,7 @@ wctdm_check_battery_lost(struct wctdm *w
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_ONHOOK);
+ fallthrough;
case BATTERY_PRESENT:
fxo->battery_state = BATTERY_DEBOUNCING_LOST;
fxo->battdebounce_timer = wc->framecount + battdebounce;
@@ -2063,6 +2064,7 @@ wctdm_check_battery_present(struct wctdm
break;
case BATTERY_UNKNOWN:
mod_hooksig(wc, mod, DAHDI_RXSIG_OFFHOOK);
+ fallthrough;
case BATTERY_LOST: /* intentional drop through */
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
fxo->battdebounce_timer = wc->framecount + battdebounce;
--- a/drivers/dahdi/xpp/card_global.c
+++ b/drivers/dahdi/xpp/card_global.c
@@ -148,7 +148,7 @@ static int execute_chip_command(xpd_t *x
XPD_NOTICE(xpd,
"'I' is deprecated in register commands. "
"Use 'S' instead.\n");
- /* fall through */
+ fallthrough;
case 'S':
do_subreg = 1;
num_args += 2; /* register + subreg */
From eea6daaa4cae1ddcd8e32c8b9e4273ba3244838c Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:19:04 +0200
Subject: [PATCH 2/6] dahdi: fix always true compilation warning
Fix always true compilation warning on statically allocated array. Check
content of the array instead.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/dahdi-base.c | 6 +++---
drivers/dahdi/dahdi_dynamic_ethmf.c | 2 +-
drivers/dahdi/xpp/xbus-core.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -923,9 +923,9 @@ static int dahdi_seq_show(struct seq_fil
if (!s)
return -ENODEV;
- if (s->name)
+ if (*(s->name))
seq_printf(sfile, "Span %d: %s ", s->spanno, s->name);
- if (s->desc)
+ if (*(s->desc))
seq_printf(sfile, "\"%s\"", s->desc);
else
seq_printf(sfile, "\"\"");
@@ -964,7 +964,7 @@ static int dahdi_seq_show(struct seq_fil
for (x = 0; x < s->channels; x++) {
struct dahdi_chan *chan = s->chans[x];
- if (chan->name)
+ if (*(chan->name))
seq_printf(sfile, "\t%4d %s ", chan->channo,
chan->name);
--- a/drivers/dahdi/dahdi_dynamic_ethmf.c
+++ b/drivers/dahdi/dahdi_dynamic_ethmf.c
@@ -535,7 +535,7 @@ static void ztdethmf_destroy(struct dahd
kfree(z->msgbuf);
kfree(z);
} else {
- if (z && z->span && z->span->name) {
+ if (z && z->span && *(z->span->name)) {
printk(KERN_ERR "Cannot find interface for %s\n",
z->span->name);
}
--- a/drivers/dahdi/xpp/xbus-core.c
+++ b/drivers/dahdi/xpp/xbus-core.c
@@ -120,7 +120,7 @@ int xbus_check_unique(xbus_t *xbus)
{
if (!xbus)
return -ENOENT;
- if (xbus->label && *(xbus->label)) {
+ if (*(xbus->label)) {
xbus_t *xbus_old;
XBUS_DBG(DEVICES, xbus, "Checking LABEL='%s'\n", xbus->label);
From d0699f781e96df6c1fd10551c92fa27695b297da Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:19:45 +0200
Subject: [PATCH 3/6] dahdi-sysfs-chan: fix bug if clause does not guard
Fix bug if clause does not guard by a typo by missing the if clause and
not correctly removing the device.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/dahdi-sysfs-chan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/dahdi/dahdi-sysfs-chan.c
+++ b/drivers/dahdi/dahdi-sysfs-chan.c
@@ -381,10 +381,11 @@ static void fixed_devfiles_remove(void)
return;
for (i = 0; i < ARRAY_SIZE(fixed_minors); i++) {
void *d = fixed_minors[i].dev;
- if (d && !IS_ERR(d))
+ if (d && !IS_ERR(d)) {
dahdi_dbg(DEVICES, "Removing fixed device file %s\n",
fixed_minors[i].name);
DEL_DAHDI_DEV(fixed_minors[i].minor);
+ }
}
}
From be9cab7860ef0872e9fa0a0bc42f1a391d7ac8da Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:20:42 +0200
Subject: [PATCH 4/6] wcte13xp: fix missing break in t13x_set_linemode
Fix missing break in t13x_set_linemode as currently it does uncorrectly
fallthrough.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/wcte13xp-base.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/dahdi/wcte13xp-base.c
+++ b/drivers/dahdi/wcte13xp-base.c
@@ -1875,6 +1875,7 @@ static int t13x_set_linemode(struct dahd
"Changing from %s to E1 line mode.\n",
dahdi_spantype2str(wc->span.spantype));
res = t13x_software_init(wc, J1);
+ break;
default:
dev_err(&wc->xb.pdev->dev,
"Got invalid linemode '%s' from dahdi\n",
From 88cfe20bcd0be443fc7613fd287147d1c54b5f7f Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:21:39 +0200
Subject: [PATCH 5/6] dahdi: skip checking on releasing
Skip checking on releasing since xb is statically allocated and always
present.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/wcte13xp-base.c | 3 +--
drivers/dahdi/wcte43x-base.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
--- a/drivers/dahdi/wcte13xp-base.c
+++ b/drivers/dahdi/wcte13xp-base.c
@@ -2702,8 +2702,7 @@ static int __devinit te13xp_init_one(str
return 0;
fail_exit:
- if (&wc->xb)
- wcxb_release(&wc->xb);
+ wcxb_release(&wc->xb);
free_wc(wc);
return res;
--- a/drivers/dahdi/wcte43x-base.c
+++ b/drivers/dahdi/wcte43x-base.c
@@ -3515,8 +3515,7 @@ static int __devinit t43x_init_one(struc
return 0;
fail_exit:
- if (&wc->xb)
- wcxb_release(&wc->xb);
+ wcxb_release(&wc->xb);
if (debug)
dev_info(&wc->xb.pdev->dev, "***At fail_exit in init_one***\n");
From 14a9e676d635b1c2be1bab4114cc76c1793892d0 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 12 May 2023 20:22:31 +0200
Subject: [PATCH 6/6] dahdi: xpp: fix wrong printf to %d
Fix wrong printf that should be %d with int variables.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/dahdi/xpp/xbus-core.c | 2 +-
drivers/dahdi/xpp/xframe_queue.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/dahdi/xpp/xbus-core.c
+++ b/drivers/dahdi/xpp/xbus-core.c
@@ -1772,7 +1772,7 @@ static void xbus_fill_proc_queue(struct
s32 rem;
s64 lag_sec = div_s64_rem(q->worst_lag_usec, 1000, &rem);
seq_printf(sfile,
- "%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%ld ms\n",
+ "%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%d ms\n",
q->name, q->steady_state_count, q->count, q->max_count,
q->worst_count, q->overflows, lag_sec,
rem);
--- a/drivers/dahdi/xpp/xframe_queue.c
+++ b/drivers/dahdi/xpp/xframe_queue.c
@@ -44,7 +44,7 @@ static void __xframe_dump_queue(struct x
s32 rem;
s64 sec = div_s64_rem(ktime_us_delta(now, xframe->kt_queued), 1000, &rem);
- snprintf(prefix, ARRAY_SIZE(prefix), " %3d> %5lld.%03ld msec",
+ snprintf(prefix, ARRAY_SIZE(prefix), " %3d> %5lld.%03d msec",
i++, sec, rem);
dump_packet(prefix, pack, 1);
}
@@ -64,7 +64,7 @@ static bool __xframe_enqueue(struct xfra
if ((overflow_cnt++ % 1000) < 5) {
s32 rem;
s64 lag_sec = div_s64_rem(q->worst_lag_usec, 1000, &rem);
- NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%ld ms\n",
+ NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%d ms\n",
q->name, q->steady_state_count, q->count,
q->max_count, q->worst_count, q->overflows,
lag_sec,
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册