linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings
@ 2016-01-08 12:32 tim.gardner
  2016-01-08 12:32 ` [PATCH v4.4-rc8 1/7] isdn: eicon: message: Silence frame size warning tim.gardner
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: tim.gardner @ 2016-01-08 12:32 UTC (permalink / raw)
  To: Armin Schindler, Karsten Keil, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v4.4-rc8 1/7] isdn: eicon: message: Silence frame size warning
  2016-01-08 12:32 [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings tim.gardner
@ 2016-01-08 12:32 ` tim.gardner
  2016-01-08 12:32 ` [PATCH v4.4-rc8 2/7] isdn: eicon: capifunc: " tim.gardner
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: tim.gardner @ 2016-01-08 12:32 UTC (permalink / raw)
  To: Armin Schindler, Karsten Keil, netdev, linux-kernel; +Cc: Tim Gardner

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4.4-rc8 2/7] isdn: eicon: capifunc: Silence frame size warning
  2016-01-08 12:32 [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings tim.gardner
  2016-01-08 12:32 ` [PATCH v4.4-rc8 1/7] isdn: eicon: message: Silence frame size warning tim.gardner
@ 2016-01-08 12:32 ` tim.gardner
  2016-01-08 12:32 ` [PATCH v4.4-rc8 3/7] isdn: eicon: idifunc: " tim.gardner
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: tim.gardner @ 2016-01-08 12:32 UTC (permalink / raw)
  To: Armin Schindler, Karsten Keil, netdev, linux-kernel; +Cc: Tim Gardner

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4.4-rc8 3/7] isdn: eicon: idifunc: Silence frame size warning
  2016-01-08 12:32 [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings tim.gardner
  2016-01-08 12:32 ` [PATCH v4.4-rc8 1/7] isdn: eicon: message: Silence frame size warning tim.gardner
  2016-01-08 12:32 ` [PATCH v4.4-rc8 2/7] isdn: eicon: capifunc: " tim.gardner
@ 2016-01-08 12:32 ` tim.gardner
  2016-01-08 12:32 ` [PATCH v4.4-rc8 4/7] isdn: eicon: mntfunc: " tim.gardner
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: tim.gardner @ 2016-01-08 12:32 UTC (permalink / raw)
  To: Armin Schindler, Karsten Keil, netdev, linux-kernel; +Cc: Tim Gardner

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4.4-rc8 4/7] isdn: eicon: mntfunc: Silence frame size warning
  2016-01-08 12:32 [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings tim.gardner
                   ` (2 preceding siblings ...)
  2016-01-08 12:32 ` [PATCH v4.4-rc8 3/7] isdn: eicon: idifunc: " tim.gardner
@ 2016-01-08 12:32 ` tim.gardner
  2016-01-08 12:32 ` [PATCH v4.4-rc8 5/7] isdn: eicon: divasfunc: " tim.gardner
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: tim.gardner @ 2016-01-08 12:32 UTC (permalink / raw)
  To: Armin Schindler, Karsten Keil, netdev, linux-kernel; +Cc: Tim Gardner

From: Tim Gardner <tim.gardner@canonical.com>

drivers/isdn/hardware/eicon/mntfunc.c: In function 'connect_didd':
drivers/isdn/hardware/eicon/mntfunc.c:112: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/mntfunc.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/hardware/eicon/mntfunc.c b/drivers/isdn/hardware/eicon/mntfunc.c
index 1cd9aff..4c25f30 100644
--- a/drivers/isdn/hardware/eicon/mntfunc.c
+++ b/drivers/isdn/hardware/eicon/mntfunc.c
@@ -77,9 +77,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 */
@@ -91,8 +95,10 @@ 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;
 			/* Register MAINT (me) */
 			req.didd_add_adapter.e.Req = 0;
@@ -101,13 +107,18 @@ static int __init connect_didd(void)
 			req.didd_add_adapter.info.descriptor =
 				(void *) &MaintDescriptor;
 			DAdapter.request((ENTITY *)&req);
-			if (req.didd_add_adapter.e.Rc != 0xff)
-				return (0);
+			if (req.didd_add_adapter.e.Rc != 0xff) {
+				dadapter = 0;
+				goto out;
+			}
 		} else if ((DIDD_Table[x].type > 0)
 			   && (DIDD_Table[x].type < 16)) {
 			diva_mnt_add_xdi_adapter(&DIDD_Table[x]);
 		}
 	}
+
+out:
+	kfree(DIDD_Table);
 	return (dadapter);
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4.4-rc8 5/7] isdn: eicon: divasfunc: Silence frame size warning
  2016-01-08 12:32 [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings tim.gardner
                   ` (3 preceding siblings ...)
  2016-01-08 12:32 ` [PATCH v4.4-rc8 4/7] isdn: eicon: mntfunc: " tim.gardner
@ 2016-01-08 12:32 ` tim.gardner
  2016-01-08 20:05   ` Sergei Shtylyov
  2016-01-08 12:32 ` [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: " tim.gardner
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: tim.gardner @ 2016-01-08 12:32 UTC (permalink / raw)
  To: Armin Schindler, Karsten Keil, netdev, linux-kernel; +Cc: Tim Gardner

From: Tim Gardner <tim.gardner@canonical.com>

drivers/isdn/hardware/eicon/divasfunc.c: In function 'connect_didd':
drivers/isdn/hardware/eicon/divasfunc.c:192: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/divasfunc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/hardware/eicon/divasfunc.c b/drivers/isdn/hardware/eicon/divasfunc.c
index 4be5f88..ac4c04a 100644
--- a/drivers/isdn/hardware/eicon/divasfunc.c
+++ b/drivers/isdn/hardware/eicon/divasfunc.c
@@ -158,10 +158,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 */
 			dadapter = 1;
@@ -174,7 +177,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 */
@@ -188,6 +192,8 @@ static int __init connect_didd(void)
 		stop_dbg();
 	}
 
+out:
+	kfree(DIDD_Table);
 	return (dadapter);
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning
  2016-01-08 12:32 [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings tim.gardner
                   ` (4 preceding siblings ...)
  2016-01-08 12:32 ` [PATCH v4.4-rc8 5/7] isdn: eicon: divasfunc: " tim.gardner
@ 2016-01-08 12:32 ` tim.gardner
  2016-01-08 20:04   ` Sergei Shtylyov
  2016-01-08 12:32 ` [PATCH v4.4-rc8 7/7] isdn: eicon: consolidate descriptor allocation tim.gardner
  2016-01-11  3:53 ` [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings David Miller
  7 siblings, 1 reply; 13+ messages in thread
From: tim.gardner @ 2016-01-08 12:32 UTC (permalink / raw)
  To: Armin Schindler, Karsten Keil, netdev, linux-kernel; +Cc: Tim Gardner

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4.4-rc8 7/7] isdn: eicon: consolidate descriptor allocation
  2016-01-08 12:32 [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings tim.gardner
                   ` (5 preceding siblings ...)
  2016-01-08 12:32 ` [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: " tim.gardner
@ 2016-01-08 12:32 ` tim.gardner
  2016-01-11  3:53 ` [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings David Miller
  7 siblings, 0 replies; 13+ messages in thread
From: tim.gardner @ 2016-01-08 12:32 UTC (permalink / raw)
  To: Armin Schindler, Karsten Keil, netdev, linux-kernel; +Cc: Tim Gardner

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning
  2016-01-08 12:32 ` [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: " tim.gardner
@ 2016-01-08 20:04   ` Sergei Shtylyov
  2016-01-08 22:05     ` Tim Gardner
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2016-01-08 20:04 UTC (permalink / raw)
  To: tim.gardner, Armin Schindler, Karsten Keil, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4.4-rc8 5/7] isdn: eicon: divasfunc: Silence frame size warning
  2016-01-08 12:32 ` [PATCH v4.4-rc8 5/7] isdn: eicon: divasfunc: " tim.gardner
@ 2016-01-08 20:05   ` Sergei Shtylyov
  0 siblings, 0 replies; 13+ messages in thread
From: Sergei Shtylyov @ 2016-01-08 20:05 UTC (permalink / raw)
  To: tim.gardner, Armin Schindler, Karsten Keil, netdev, linux-kernel

On 01/08/2016 03:32 PM, tim.gardner@canonical.com wrote:

> From: Tim Gardner <tim.gardner@canonical.com>
>
> drivers/isdn/hardware/eicon/divasfunc.c: In function 'connect_didd':
> drivers/isdn/hardware/eicon/divasfunc.c:192: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/divasfunc.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/isdn/hardware/eicon/divasfunc.c b/drivers/isdn/hardware/eicon/divasfunc.c
> index 4be5f88..ac4c04a 100644
> --- a/drivers/isdn/hardware/eicon/divasfunc.c
> +++ b/drivers/isdn/hardware/eicon/divasfunc.c
> @@ -158,10 +158,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);

    kmalloc_array()?

MBR, Sergei

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning
  2016-01-08 20:04   ` Sergei Shtylyov
@ 2016-01-08 22:05     ` Tim Gardner
  2016-01-08 22:20       ` Sergei Shtylyov
  0 siblings, 1 reply; 13+ messages in thread
From: Tim Gardner @ 2016-01-08 22:05 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Armin Schindler, Karsten Keil, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: Silence frame size warning
  2016-01-08 22:05     ` Tim Gardner
@ 2016-01-08 22:20       ` Sergei Shtylyov
  0 siblings, 0 replies; 13+ messages in thread
From: Sergei Shtylyov @ 2016-01-08 22:20 UTC (permalink / raw)
  To: Tim Gardner; +Cc: Armin Schindler, Karsten Keil, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings
  2016-01-08 12:32 [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings tim.gardner
                   ` (6 preceding siblings ...)
  2016-01-08 12:32 ` [PATCH v4.4-rc8 7/7] isdn: eicon: consolidate descriptor allocation tim.gardner
@ 2016-01-11  3:53 ` David Miller
  7 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2016-01-11  3:53 UTC (permalink / raw)
  To: tim.gardner; +Cc: mac, isdn, netdev, linux-kernel

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-01-11  3:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08 12:32 [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings tim.gardner
2016-01-08 12:32 ` [PATCH v4.4-rc8 1/7] isdn: eicon: message: Silence frame size warning tim.gardner
2016-01-08 12:32 ` [PATCH v4.4-rc8 2/7] isdn: eicon: capifunc: " tim.gardner
2016-01-08 12:32 ` [PATCH v4.4-rc8 3/7] isdn: eicon: idifunc: " tim.gardner
2016-01-08 12:32 ` [PATCH v4.4-rc8 4/7] isdn: eicon: mntfunc: " tim.gardner
2016-01-08 12:32 ` [PATCH v4.4-rc8 5/7] isdn: eicon: divasfunc: " tim.gardner
2016-01-08 20:05   ` Sergei Shtylyov
2016-01-08 12:32 ` [PATCH v4.4-rc8 6/7] isdn: eicon: diddfunc: " tim.gardner
2016-01-08 20:04   ` Sergei Shtylyov
2016-01-08 22:05     ` Tim Gardner
2016-01-08 22:20       ` Sergei Shtylyov
2016-01-08 12:32 ` [PATCH v4.4-rc8 7/7] isdn: eicon: consolidate descriptor allocation tim.gardner
2016-01-11  3:53 ` [PATCH v4.4-rc8 0/7] isdn: eicon: Silence frame size warnings David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).