Commit 3a38ea66 authored by Randy Dunlap's avatar Randy Dunlap Committed by Greg Kroah-Hartman

[PATCH] sidewinder: reduce stack usage

reduce stack usage in sw_connect() from 0x490 to 0x98 on P4 SMP (gcc 3.2);
parent 58800fb0
......@@ -573,8 +573,8 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev)
{
struct sw *sw;
int i, j, k, l;
unsigned char buf[SW_LENGTH];
unsigned char idbuf[SW_LENGTH];
unsigned char *buf = NULL; /* [SW_LENGTH] */
unsigned char *idbuf = NULL; /* [SW_LENGTH] */
unsigned char m = 1;
char comment[40];
......@@ -583,6 +583,11 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev)
if (!(sw = kmalloc(sizeof(struct sw), GFP_KERNEL))) return;
memset(sw, 0, sizeof(struct sw));
buf = kmalloc(SW_LENGTH, GFP_KERNEL);
idbuf = kmalloc(SW_LENGTH, GFP_KERNEL);
if (!buf || !idbuf)
goto fail1;
gameport->private = sw;
sw->gameport = gameport;
......@@ -739,6 +744,8 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev)
return;
fail2: gameport_close(gameport);
fail1: kfree(sw);
kfree(buf);
kfree(idbuf);
}
static void sw_disconnect(struct gameport *gameport)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment