diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-11-01 12:09:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-11-07 12:04:00 -0500 |
commit | 1d212cf0c2d89adf3d0a6d62d729076f49f087dc (patch) | |
tree | d324859ec7a1269c995f7e6945a8cda129b7c6be /drivers/media | |
parent | 51d8e7fbffe34dc1c75ad28b49d0bcd210792424 (diff) |
[media] cx18: struct i2c_client is too big for stack
drivers/media/pci/cx18/cx18-driver.c: In function 'cx18_read_eeprom':
drivers/media/pci/cx18/cx18-driver.c:357:1: warning: the frame size of 1072 bytes is larger than 1024 bytes [-Wframe-larger-than=]
That happens because the routine allocates 256 bytes for an eeprom buffer, plus
the size of struct i2c_client, with is big.
Change the logic to dynamically allocate/deallocate space for struct i2c_client,
instead of using the stack.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/pci/cx18/cx18-driver.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index ff7232023f56..c1f8cc6f14b2 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c | |||
@@ -324,23 +324,24 @@ static void cx18_eeprom_dump(struct cx18 *cx, unsigned char *eedata, int len) | |||
324 | /* Hauppauge card? get values from tveeprom */ | 324 | /* Hauppauge card? get values from tveeprom */ |
325 | void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) | 325 | void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) |
326 | { | 326 | { |
327 | struct i2c_client c; | 327 | struct i2c_client *c; |
328 | u8 eedata[256]; | 328 | u8 eedata[256]; |
329 | 329 | ||
330 | memset(&c, 0, sizeof(c)); | 330 | c = kzalloc(sizeof(*c), GFP_KERNEL); |
331 | strlcpy(c.name, "cx18 tveeprom tmp", sizeof(c.name)); | 331 | |
332 | c.adapter = &cx->i2c_adap[0]; | 332 | strlcpy(c->name, "cx18 tveeprom tmp", sizeof(c->name)); |
333 | c.addr = 0xA0 >> 1; | 333 | c->adapter = &cx->i2c_adap[0]; |
334 | c->addr = 0xa0 >> 1; | ||
334 | 335 | ||
335 | memset(tv, 0, sizeof(*tv)); | 336 | memset(tv, 0, sizeof(*tv)); |
336 | if (tveeprom_read(&c, eedata, sizeof(eedata))) | 337 | if (tveeprom_read(c, eedata, sizeof(eedata))) |
337 | return; | 338 | goto ret; |
338 | 339 | ||
339 | switch (cx->card->type) { | 340 | switch (cx->card->type) { |
340 | case CX18_CARD_HVR_1600_ESMT: | 341 | case CX18_CARD_HVR_1600_ESMT: |
341 | case CX18_CARD_HVR_1600_SAMSUNG: | 342 | case CX18_CARD_HVR_1600_SAMSUNG: |
342 | case CX18_CARD_HVR_1600_S5H1411: | 343 | case CX18_CARD_HVR_1600_S5H1411: |
343 | tveeprom_hauppauge_analog(&c, tv, eedata); | 344 | tveeprom_hauppauge_analog(c, tv, eedata); |
344 | break; | 345 | break; |
345 | case CX18_CARD_YUAN_MPC718: | 346 | case CX18_CARD_YUAN_MPC718: |
346 | case CX18_CARD_GOTVIEW_PCI_DVD3: | 347 | case CX18_CARD_GOTVIEW_PCI_DVD3: |
@@ -354,6 +355,9 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) | |||
354 | cx18_eeprom_dump(cx, eedata, sizeof(eedata)); | 355 | cx18_eeprom_dump(cx, eedata, sizeof(eedata)); |
355 | break; | 356 | break; |
356 | } | 357 | } |
358 | |||
359 | ret: | ||
360 | kfree(c); | ||
357 | } | 361 | } |
358 | 362 | ||
359 | static void cx18_process_eeprom(struct cx18 *cx) | 363 | static void cx18_process_eeprom(struct cx18 *cx) |