summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/ir-kbd-i2c.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-02-25 20:51:00 +0000
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-02-25 20:51:00 +0000
commit02f63ce8fd4d1c7ee5e5ba9d4eab01f9cff12f94 (patch)
treea2402ab95e6650138585e73cbaf34da284805cc1 /linux/drivers/media/video/ir-kbd-i2c.c
parent7911ae25ba666ead539f0c5136f19515f631db8a (diff)
downloadmediapointer-dvb-s2-02f63ce8fd4d1c7ee5e5ba9d4eab01f9cff12f94.tar.gz
mediapointer-dvb-s2-02f63ce8fd4d1c7ee5e5ba9d4eab01f9cff12f94.tar.bz2
limit stack usage of ir-kbd-i2c.c
From: Marcin Slusarz <marcin.slusarz@gmail.com> ir_probe allocated struct i2c_client on stack; it's pretty big structure, so allocate it with kzalloc make checkstack output without this patch: x059d ir_probe [ir-kbd-i2c]: 1000 Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/ir-kbd-i2c.c')
-rw-r--r--linux/drivers/media/video/ir-kbd-i2c.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c
index c68add9aa..7bde716ad 100644
--- a/linux/drivers/media/video/ir-kbd-i2c.c
+++ b/linux/drivers/media/video/ir-kbd-i2c.c
@@ -531,9 +531,9 @@ static int ir_probe(struct i2c_adapter *adap)
static const int probe_cx88[] = { 0x18, 0x6b, 0x71, -1 };
static const int probe_cx23885[] = { 0x6b, -1 };
const int *probe = NULL;
- struct i2c_client c;
+ struct i2c_client *c;
unsigned char buf;
- int i,rc;
+ int i, rc;
switch (adap->id) {
case I2C_HW_B_BT848:
@@ -558,19 +558,23 @@ static int ir_probe(struct i2c_adapter *adap)
if (NULL == probe)
return 0;
- memset(&c,0,sizeof(c));
- c.adapter = adap;
+ c = kzalloc(sizeof(*c), GFP_KERNEL);
+ if (!c)
+ return -ENOMEM;
+
+ c->adapter = adap;
for (i = 0; -1 != probe[i]; i++) {
- c.addr = probe[i];
- rc = i2c_master_recv(&c,&buf,0);
+ c->addr = probe[i];
+ rc = i2c_master_recv(c, &buf, 0);
dprintk(1,"probe 0x%02x @ %s: %s\n",
probe[i], adap->name,
(0 == rc) ? "yes" : "no");
if (0 == rc) {
- ir_attach(adap,probe[i],0,0);
+ ir_attach(adap, probe[i], 0, 0);
break;
}
}
+ kfree(c);
return 0;
}