Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1304488 > unrolled thread
| Started by | tim.gardner@canonical.com |
|---|---|
| First post | 2016-01-08 13:40 +0100 |
| Last post | 2016-01-11 05:00 +0100 |
| Articles | 10 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings tim.gardner@canonical.com - 2016-01-08 13:40 +0100
[PATCH v4.4-rc8 2/7] isdn: eicon: capifunc: Silence frame size warning tim.gardner@canonical.com - 2016-01-08 13:40 +0100
[PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning tim.gardner@canonical.com - 2016-01-08 13:40 +0100
Re: [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-01-08 21:10 +0100
Re: [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning Tim Gardner <tim.gardner@canonical.com> - 2016-01-08 23:20 +0100
Re: [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-01-08 23:30 +0100
[PATCH v4.4-rc8 1/7] isdn: eicon: message: Silence frame size warning tim.gardner@canonical.com - 2016-01-08 13:40 +0100
[PATCH v4.4-rc8 3/7] isdn: eicon: idifunc: Silence frame size warning tim.gardner@canonical.com - 2016-01-08 13:40 +0100
[PATCH v4.4-rc8 7/7] isdn: eicon: consolidate descriptor allocation tim.gardner@canonical.com - 2016-01-08 13:40 +0100
Re: [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings David Miller <davem@davemloft.net> - 2016-01-11 05:00 +0100
| From | tim.gardner@canonical.com |
|---|---|
| Date | 2016-01-08 13:40 +0100 |
| Subject | [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings |
| Message-ID | <qOEuJ-6IK-3@gated-at.bofh.it> |
Following is a patch set to recode various functions within the eicon driver in order to silence frame size warnings. The final patch consolidates some of this code into a single function which hopefully reduces complexity and the amount of code. -- Tim Gardner tim.gardner@canonical.com
[toc] | [next] | [standalone]
| From | tim.gardner@canonical.com |
|---|---|
| Date | 2016-01-08 13:40 +0100 |
| Subject | [PATCH v4.4-rc8 2/7] isdn: eicon: capifunc: Silence frame size warning |
| Message-ID | <qOEuK-6IK-21@gated-at.bofh.it> |
| In reply to | #1304488 |
From: Tim Gardner <tim.gardner@canonical.com>
drivers/isdn/hardware/eicon/capifunc.c: In function 'divacapi_connect_didd':
drivers/isdn/hardware/eicon/capifunc.c:1094:1: warning: the frame size of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=]
gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)
Cc: Armin Schindler <mac@melware.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
drivers/isdn/hardware/eicon/capifunc.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/isdn/hardware/eicon/capifunc.c b/drivers/isdn/hardware/eicon/capifunc.c
index 7a0bdbd..5fb441f 100644
--- a/drivers/isdn/hardware/eicon/capifunc.c
+++ b/drivers/isdn/hardware/eicon/capifunc.c
@@ -1053,9 +1053,13 @@ static int divacapi_connect_didd(void)
int x = 0;
int dadapter = 0;
IDI_SYNC_REQ req;
- DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
+ DESCRIPTOR *DIDD_Table;
- DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
+ DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table), GFP_KERNEL);
+ if (!DIDD_Table)
+ goto out;
+
+ DIVA_DIDD_Read(DIDD_Table, MAX_DESCRIPTORS * sizeof(*DIDD_Table));
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
@@ -1077,7 +1081,8 @@ static int divacapi_connect_didd(void)
DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff) {
stop_dbg();
- return (0);
+ dadapter = 0;
+ goto out;
}
notify_handle = req.didd_notify.info.handle;
}
@@ -1090,6 +1095,8 @@ static int divacapi_connect_didd(void)
stop_dbg();
}
+out:
+ kfree(DIDD_Table);
return (dadapter);
}
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | tim.gardner@canonical.com |
|---|---|
| Date | 2016-01-08 13:40 +0100 |
| Subject | [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning |
| Message-ID | <qOEuK-6IK-23@gated-at.bofh.it> |
| In reply to | #1304488 |
From: Tim Gardner <tim.gardner@canonical.com>
drivers/isdn/hardware/eicon/diddfunc.c: In function 'connect_didd':
drivers/isdn/hardware/eicon/diddfunc.c:77:1: warning: the frame size of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=]
gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)
Cc: Armin Schindler <mac@melware.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
drivers/isdn/hardware/eicon/diddfunc.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/isdn/hardware/eicon/diddfunc.c b/drivers/isdn/hardware/eicon/diddfunc.c
index b0b23ed..a9feb4f 100644
--- a/drivers/isdn/hardware/eicon/diddfunc.c
+++ b/drivers/isdn/hardware/eicon/diddfunc.c
@@ -52,9 +52,13 @@ static int __init connect_didd(void)
int x = 0;
int dadapter = 0;
IDI_SYNC_REQ req;
- DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
+ DESCRIPTOR *DIDD_Table;
- DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
+ DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table), GFP_KERNEL);
+ if (!DIDD_Table)
+ goto out;
+
+ DIVA_DIDD_Read(DIDD_Table, MAX_DESCRIPTORS * sizeof(*DIDD_Table));
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
@@ -66,13 +70,18 @@ static int __init connect_didd(void)
req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = NULL;
_DAdapter.request((ENTITY *)&req);
- if (req.didd_notify.e.Rc != 0xff)
- return (0);
+ if (req.didd_notify.e.Rc != 0xff) {
+ dadapter = 0;
+ goto out;
+ }
notify_handle = req.didd_notify.info.handle;
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
DbgRegister("DIDD", DRIVERRELEASE_DIDD, DBG_DEFAULT);
}
}
+
+out:
+ kfree(DIDD_Table);
return (dadapter);
}
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
|---|---|
| Date | 2016-01-08 21:10 +0100 |
| Subject | Re: [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning |
| Message-ID | <qOLwe-3l9-1@gated-at.bofh.it> |
| In reply to | #1304492 |
Hello. On 01/08/2016 03:32 PM, tim.gardner@canonical.com wrote: > From: Tim Gardner <tim.gardner@canonical.com> > > drivers/isdn/hardware/eicon/diddfunc.c: In function 'connect_didd': > drivers/isdn/hardware/eicon/diddfunc.c:77:1: warning: the frame size of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=] > > gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1) > > Cc: Armin Schindler <mac@melware.de> > Cc: Karsten Keil <isdn@linux-pingi.de> > Signed-off-by: Tim Gardner <tim.gardner@canonical.com> > --- > drivers/isdn/hardware/eicon/diddfunc.c | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/drivers/isdn/hardware/eicon/diddfunc.c b/drivers/isdn/hardware/eicon/diddfunc.c > index b0b23ed..a9feb4f 100644 > --- a/drivers/isdn/hardware/eicon/diddfunc.c > +++ b/drivers/isdn/hardware/eicon/diddfunc.c > @@ -52,9 +52,13 @@ static int __init connect_didd(void) > int x = 0; > int dadapter = 0; > IDI_SYNC_REQ req; > - DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS]; > + DESCRIPTOR *DIDD_Table; > > - DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table)); > + DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table), GFP_KERNEL); Previously the array didn't seem to be zeroed, perhaps it's better to use kmalloc_array()? [...] MHR, Sergei
[toc] | [prev] | [next] | [standalone]
| From | Tim Gardner <tim.gardner@canonical.com> |
|---|---|
| Date | 2016-01-08 23:20 +0100 |
| Subject | Re: [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning |
| Message-ID | <qONy2-4Fy-9@gated-at.bofh.it> |
| In reply to | #1304979 |
On 01/08/2016 01:04 PM, Sergei Shtylyov wrote: > Hello. > > On 01/08/2016 03:32 PM, tim.gardner@canonical.com wrote: > >> From: Tim Gardner <tim.gardner@canonical.com> >> >> drivers/isdn/hardware/eicon/diddfunc.c: In function 'connect_didd': >> drivers/isdn/hardware/eicon/diddfunc.c:77:1: warning: the frame size >> of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=] >> >> gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1) >> >> Cc: Armin Schindler <mac@melware.de> >> Cc: Karsten Keil <isdn@linux-pingi.de> >> Signed-off-by: Tim Gardner <tim.gardner@canonical.com> >> --- >> drivers/isdn/hardware/eicon/diddfunc.c | 17 +++++++++++++---- >> 1 file changed, 13 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/isdn/hardware/eicon/diddfunc.c >> b/drivers/isdn/hardware/eicon/diddfunc.c >> index b0b23ed..a9feb4f 100644 >> --- a/drivers/isdn/hardware/eicon/diddfunc.c >> +++ b/drivers/isdn/hardware/eicon/diddfunc.c >> @@ -52,9 +52,13 @@ static int __init connect_didd(void) >> int x = 0; >> int dadapter = 0; >> IDI_SYNC_REQ req; >> - DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS]; >> + DESCRIPTOR *DIDD_Table; >> >> - DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table)); >> + DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table), >> GFP_KERNEL); > > Previously the array didn't seem to be zeroed, perhaps it's better to > use kmalloc_array()? > > [...] > > MHR, Sergei > The last patch in the series (isdn: eicon: consolidate descriptor allocation) consolidates the allocation code into one function. I used kmalloc() there because I noticed that diva_didd_read_adapter_array() does zero the buffer before using it. Do you think that is sufficient ? rtg -- Tim Gardner tim.gardner@canonical.com
[toc] | [prev] | [next] | [standalone]
| From | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
|---|---|
| Date | 2016-01-08 23:30 +0100 |
| Subject | Re: [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning |
| Message-ID | <qONHI-4JZ-15@gated-at.bofh.it> |
| In reply to | #1305029 |
On 01/09/2016 01:05 AM, Tim Gardner wrote:
>>> From: Tim Gardner <tim.gardner@canonical.com>
>>>
>>> drivers/isdn/hardware/eicon/diddfunc.c: In function 'connect_didd':
>>> drivers/isdn/hardware/eicon/diddfunc.c:77:1: warning: the frame size
>>> of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>>>
>>> gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)
>>>
>>> Cc: Armin Schindler <mac@melware.de>
>>> Cc: Karsten Keil <isdn@linux-pingi.de>
>>> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
>>> ---
>>> drivers/isdn/hardware/eicon/diddfunc.c | 17 +++++++++++++----
>>> 1 file changed, 13 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/isdn/hardware/eicon/diddfunc.c
>>> b/drivers/isdn/hardware/eicon/diddfunc.c
>>> index b0b23ed..a9feb4f 100644
>>> --- a/drivers/isdn/hardware/eicon/diddfunc.c
>>> +++ b/drivers/isdn/hardware/eicon/diddfunc.c
>>> @@ -52,9 +52,13 @@ static int __init connect_didd(void)
>>> int x = 0;
>>> int dadapter = 0;
>>> IDI_SYNC_REQ req;
>>> - DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
>>> + DESCRIPTOR *DIDD_Table;
>>>
>>> - DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
>>> + DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table),
>>> GFP_KERNEL);
>>
>> Previously the array didn't seem to be zeroed, perhaps it's better to
>> use kmalloc_array()?
>> [...]
> The last patch in the series (isdn: eicon: consolidate descriptor
> allocation) consolidates the allocation code into one function. I used
> kmalloc() there because I noticed that diva_didd_read_adapter_array()
> does zero the buffer before using it.
>
> Do you think that is sufficient ?
If it worked before your patch, yes.
> rtg
MBR, Sergei
[toc] | [prev] | [next] | [standalone]
| From | tim.gardner@canonical.com |
|---|---|
| Date | 2016-01-08 13:40 +0100 |
| Subject | [PATCH v4.4-rc8 1/7] isdn: eicon: message: Silence frame size warning |
| Message-ID | <qOEuL-6IK-27@gated-at.bofh.it> |
| In reply to | #1304488 |
From: Tim Gardner <tim.gardner@canonical.com>
drivers/isdn/hardware/eicon/message.c: In function 'sig_ind':
drivers/isdn/hardware/eicon/message.c:6115:1: warning: the frame size of 1200 bytes is larger than 1024 bytes [-Wframe-larger-than=]
gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)
Cc: Armin Schindler <mac@melware.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
drivers/isdn/hardware/eicon/message.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index d7c2866..bee8067 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -4851,7 +4851,7 @@ static void sig_ind(PLCI *plci)
byte *esc_cr = "";
byte *esc_profile = "";
- byte facility[256];
+ byte *facility;
PLCI *tplci = NULL;
byte chi[] = "\x02\x18\x01";
byte voice_cai[] = "\x06\x14\x00\x00\x00\x00\x08";
@@ -4886,6 +4886,12 @@ static void sig_ind(PLCI *plci)
dword d;
word w;
+ facility = kmalloc(256, GFP_KERNEL);
+ if (!facility) {
+ dbug(1, dprintf("mem alloc failure"));
+ return;
+ }
+
a = plci->adapter;
Id = ((word)plci->Id << 8) | a->Id;
PUT_WORD(&SS_Ind[4], 0x0000);
@@ -4894,7 +4900,7 @@ static void sig_ind(PLCI *plci)
{
plci->Sig.RNR = 2; /* discard */
dbug(1, dprintf("SIG discard while remove pending"));
- return;
+ goto out;
}
if (plci->tel && plci->SuppState != CALL_HELD) Id |= EXT_CONTROLLER;
dbug(1, dprintf("SigInd-Id=%08lx,plci=%x,tel=%x,state=0x%x,channels=%d,Discflowcl=%d",
@@ -4902,7 +4908,7 @@ static void sig_ind(PLCI *plci)
if (plci->Sig.Ind == CALL_HOLD_ACK && plci->channels)
{
plci->Sig.RNR = 1;
- return;
+ goto out;
}
if (plci->Sig.Ind == HANGUP && plci->channels)
{
@@ -4929,7 +4935,7 @@ static void sig_ind(PLCI *plci)
plci_remove(plci);
plci->State = IDLE;
}
- return;
+ goto out;
}
/* do first parse the info with no OAD in, because OAD will be converted */
@@ -5481,7 +5487,7 @@ static void sig_ind(PLCI *plci)
{
sendf(plci->appl, _FACILITY_I, Id & 0xf, 0, "wS", 3, &pty_cai[2]);
plci_remove(plci);
- return;
+ goto out;
}
else sendf(plci->appl, _FACILITY_I, Id, 0, "wS", 3, &pty_cai[2]);
pty_cai[0] = 0;
@@ -6112,6 +6118,8 @@ static void sig_ind(PLCI *plci)
break;
}
+out:
+ kfree(facility);
}
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | tim.gardner@canonical.com |
|---|---|
| Date | 2016-01-08 13:40 +0100 |
| Subject | [PATCH v4.4-rc8 3/7] isdn: eicon: idifunc: Silence frame size warning |
| Message-ID | <qOEuM-6IK-41@gated-at.bofh.it> |
| In reply to | #1304488 |
From: Tim Gardner <tim.gardner@canonical.com>
drivers/isdn/hardware/eicon/idifunc.c: In function 'connect_didd':
drivers/isdn/hardware/eicon/idifunc.c:223:1: warning: the frame size of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=]
gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)
Cc: Armin Schindler <mac@melware.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
drivers/isdn/hardware/eicon/idifunc.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/isdn/hardware/eicon/idifunc.c b/drivers/isdn/hardware/eicon/idifunc.c
index fef6586..e7ca4bc 100644
--- a/drivers/isdn/hardware/eicon/idifunc.c
+++ b/drivers/isdn/hardware/eicon/idifunc.c
@@ -186,9 +186,13 @@ static int __init connect_didd(void)
int x = 0;
int dadapter = 0;
IDI_SYNC_REQ req;
- DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
+ DESCRIPTOR *DIDD_Table;
- DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
+ DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table), GFP_KERNEL);
+ if (!DIDD_Table)
+ goto out;
+
+ DIVA_DIDD_Read(DIDD_Table, MAX_DESCRIPTORS * sizeof(*DIDD_Table));
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
@@ -202,7 +206,8 @@ static int __init connect_didd(void)
DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff) {
stop_dbg();
- return (0);
+ dadapter = 0;
+ goto out;
}
notify_handle = req.didd_notify.info.handle;
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
@@ -219,6 +224,8 @@ static int __init connect_didd(void)
stop_dbg();
}
+out:
+ kfree(DIDD_Table);
return (dadapter);
}
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | tim.gardner@canonical.com |
|---|---|
| Date | 2016-01-08 13:40 +0100 |
| Subject | [PATCH v4.4-rc8 7/7] isdn: eicon: consolidate descriptor allocation |
| Message-ID | <qOEuM-6IK-39@gated-at.bofh.it> |
| In reply to | #1304488 |
From: Tim Gardner <tim.gardner@canonical.com>
Collapse multiple instances of open coded descriptor allocation
and initialization into di_alloc_descriptors(). Also clean
up the various DIVA_DIDD_Read() prototypes.
Cc: Armin Schindler <mac@melware.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
drivers/isdn/hardware/eicon/capifunc.c | 6 +-----
drivers/isdn/hardware/eicon/di_defs.h | 13 +++++++++++++
drivers/isdn/hardware/eicon/diddfunc.c | 5 +----
drivers/isdn/hardware/eicon/diva_didd.c | 2 --
drivers/isdn/hardware/eicon/divasfunc.c | 5 +----
drivers/isdn/hardware/eicon/idifunc.c | 5 +----
drivers/isdn/hardware/eicon/mntfunc.c | 6 +-----
7 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/drivers/isdn/hardware/eicon/capifunc.c b/drivers/isdn/hardware/eicon/capifunc.c
index 5fb441f..427095a 100644
--- a/drivers/isdn/hardware/eicon/capifunc.c
+++ b/drivers/isdn/hardware/eicon/capifunc.c
@@ -57,8 +57,6 @@ static u16 diva_send_message(struct capi_ctr *,
diva_os_message_buffer_s *);
extern void diva_os_set_controller_struct(struct capi_ctr *);
-extern void DIVA_DIDD_Read(DESCRIPTOR *, int);
-
/*
* debug
*/
@@ -1055,12 +1053,10 @@ static int divacapi_connect_didd(void)
IDI_SYNC_REQ req;
DESCRIPTOR *DIDD_Table;
- DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table), GFP_KERNEL);
+ DIDD_Table = di_alloc_descriptors();
if (!DIDD_Table)
goto out;
- DIVA_DIDD_Read(DIDD_Table, MAX_DESCRIPTORS * sizeof(*DIDD_Table));
-
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
memcpy(&MAdapter, &DIDD_Table[x], sizeof(DAdapter));
diff --git a/drivers/isdn/hardware/eicon/di_defs.h b/drivers/isdn/hardware/eicon/di_defs.h
index a5094d2..032bc80 100644
--- a/drivers/isdn/hardware/eicon/di_defs.h
+++ b/drivers/isdn/hardware/eicon/di_defs.h
@@ -103,6 +103,19 @@ typedef struct {
word features;
IDI_CALL request;
} DESCRIPTOR;
+
+extern void DIVA_DIDD_Read(void *, int);
+
+static inline DESCRIPTOR *di_alloc_descriptors(void)
+{
+ size_t len = MAX_DESCRIPTORS * sizeof(DESCRIPTOR);
+ DESCRIPTOR *d = kmalloc(len, GFP_KERNEL);
+
+ if (d)
+ DIVA_DIDD_Read(d, len);
+ return d;
+}
+
/* descriptor type field coding */
#define IDI_ADAPTER_S 1
#define IDI_ADAPTER_PR 2
diff --git a/drivers/isdn/hardware/eicon/diddfunc.c b/drivers/isdn/hardware/eicon/diddfunc.c
index a9feb4f..cbf8930 100644
--- a/drivers/isdn/hardware/eicon/diddfunc.c
+++ b/drivers/isdn/hardware/eicon/diddfunc.c
@@ -20,7 +20,6 @@
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
-extern void DIVA_DIDD_Read(void *, int);
extern char *DRIVERRELEASE_DIDD;
static dword notify_handle;
static DESCRIPTOR _DAdapter;
@@ -54,12 +53,10 @@ static int __init connect_didd(void)
IDI_SYNC_REQ req;
DESCRIPTOR *DIDD_Table;
- DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table), GFP_KERNEL);
+ DIDD_Table = di_alloc_descriptors();
if (!DIDD_Table)
goto out;
- DIVA_DIDD_Read(DIDD_Table, MAX_DESCRIPTORS * sizeof(*DIDD_Table));
-
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
dadapter = 1;
diff --git a/drivers/isdn/hardware/eicon/diva_didd.c b/drivers/isdn/hardware/eicon/diva_didd.c
index fab6ccf..3f2f8e0 100644
--- a/drivers/isdn/hardware/eicon/diva_didd.c
+++ b/drivers/isdn/hardware/eicon/diva_didd.c
@@ -42,8 +42,6 @@ MODULE_LICENSE("GPL");
extern int diddfunc_init(void);
extern void diddfunc_finit(void);
-extern void DIVA_DIDD_Read(void *, int);
-
static struct proc_dir_entry *proc_didd;
struct proc_dir_entry *proc_net_eicon = NULL;
diff --git a/drivers/isdn/hardware/eicon/divasfunc.c b/drivers/isdn/hardware/eicon/divasfunc.c
index ac4c04a..633a9d6 100644
--- a/drivers/isdn/hardware/eicon/divasfunc.c
+++ b/drivers/isdn/hardware/eicon/divasfunc.c
@@ -23,8 +23,6 @@
static int debugmask;
-extern void DIVA_DIDD_Read(void *, int);
-
extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
extern char *DRIVERRELEASE_DIVAS;
@@ -160,11 +158,10 @@ static int __init connect_didd(void)
IDI_SYNC_REQ req;
DESCRIPTOR *DIDD_Table;
- DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table), GFP_KERNEL);
+ DIDD_Table = di_alloc_descriptors();
if (!DIDD_Table)
goto out;
- DIVA_DIDD_Read(DIDD_Table, MAX_DESCRIPTORS * sizeof(*DIDD_Table));
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
dadapter = 1;
diff --git a/drivers/isdn/hardware/eicon/idifunc.c b/drivers/isdn/hardware/eicon/idifunc.c
index e7ca4bc..61763df 100644
--- a/drivers/isdn/hardware/eicon/idifunc.c
+++ b/drivers/isdn/hardware/eicon/idifunc.c
@@ -21,7 +21,6 @@
extern char *DRIVERRELEASE_IDI;
-extern void DIVA_DIDD_Read(void *, int);
extern int diva_user_mode_idi_create_adapter(const DESCRIPTOR *, int);
extern void diva_user_mode_idi_remove_adapter(int);
@@ -188,12 +187,10 @@ static int __init connect_didd(void)
IDI_SYNC_REQ req;
DESCRIPTOR *DIDD_Table;
- DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table), GFP_KERNEL);
+ DIDD_Table = di_alloc_descriptors();
if (!DIDD_Table)
goto out;
- DIVA_DIDD_Read(DIDD_Table, MAX_DESCRIPTORS * sizeof(*DIDD_Table));
-
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
dadapter = 1;
diff --git a/drivers/isdn/hardware/eicon/mntfunc.c b/drivers/isdn/hardware/eicon/mntfunc.c
index 4c25f30..5305458 100644
--- a/drivers/isdn/hardware/eicon/mntfunc.c
+++ b/drivers/isdn/hardware/eicon/mntfunc.c
@@ -21,8 +21,6 @@ extern char *DRIVERRELEASE_MNT;
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
-extern void DIVA_DIDD_Read(void *, int);
-
static dword notify_handle;
static DESCRIPTOR DAdapter;
static DESCRIPTOR MAdapter;
@@ -79,12 +77,10 @@ static int __init connect_didd(void)
IDI_SYNC_REQ req;
DESCRIPTOR *DIDD_Table;
- DIDD_Table = kcalloc(MAX_DESCRIPTORS, sizeof(*DIDD_Table), GFP_KERNEL);
+ DIDD_Table = di_alloc_descriptors();
if (!DIDD_Table)
goto out;
- DIVA_DIDD_Read(DIDD_Table, MAX_DESCRIPTORS * sizeof(*DIDD_Table));
-
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
dadapter = 1;
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-01-11 05:00 +0100 |
| Message-ID | <qPBOf-5gC-113@gated-at.bofh.it> |
| In reply to | #1304488 |
From: tim.gardner@canonical.com Date: Fri, 8 Jan 2016 05:32:48 -0700 > Following is a patch set to recode various functions within the eicon driver in > order to silence frame size warnings. The final patch consolidates some of this > code into a single function which hopefully reduces complexity and the amount > of code. If you were just fixing one case of this I wouldn't be so strict but the following, but because you are changing several such cases I am going to be. You have to add appropriate -ENOMEM error propragation and handling into the callers of these functions.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web