ChangeSet 1.1180, 2003/04/30 11:58:30-07:00, randy.dunlap@verizon.net [PATCH] sidewinder: reduce stack usage reduce stack usage in sw_connect() from 0x490 to 0x98 on P4 SMP (gcc 3.2); diff -Nru a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c --- a/drivers/input/joystick/sidewinder.c Wed Apr 30 13:31:42 2003 +++ b/drivers/input/joystick/sidewinder.c Wed Apr 30 13:31:42 2003 @@ -573,8 +573,8 @@ { 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 @@ 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 @@ return; fail2: gameport_close(gameport); fail1: kfree(sw); + kfree(buf); + kfree(idbuf); } static void sw_disconnect(struct gameport *gameport)