aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/ir-kbd-i2c.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index ba7a74979dfb..58a1ddddb09e 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -509,9 +509,9 @@ static int ir_probe(struct i2c_adapter *adap)
509 static const int probe_cx88[] = { 0x18, 0x6b, 0x71, -1 }; 509 static const int probe_cx88[] = { 0x18, 0x6b, 0x71, -1 };
510 static const int probe_cx23885[] = { 0x6b, -1 }; 510 static const int probe_cx23885[] = { 0x6b, -1 };
511 const int *probe = NULL; 511 const int *probe = NULL;
512 struct i2c_client c; 512 struct i2c_client *c;
513 unsigned char buf; 513 unsigned char buf;
514 int i,rc; 514 int i, rc;
515 515
516 switch (adap->id) { 516 switch (adap->id) {
517 case I2C_HW_B_BT848: 517 case I2C_HW_B_BT848:
@@ -536,19 +536,23 @@ static int ir_probe(struct i2c_adapter *adap)
536 if (NULL == probe) 536 if (NULL == probe)
537 return 0; 537 return 0;
538 538
539 memset(&c,0,sizeof(c)); 539 c = kzalloc(sizeof(*c), GFP_KERNEL);
540 c.adapter = adap; 540 if (!c)
541 return -ENOMEM;
542
543 c->adapter = adap;
541 for (i = 0; -1 != probe[i]; i++) { 544 for (i = 0; -1 != probe[i]; i++) {
542 c.addr = probe[i]; 545 c->addr = probe[i];
543 rc = i2c_master_recv(&c,&buf,0); 546 rc = i2c_master_recv(c, &buf, 0);
544 dprintk(1,"probe 0x%02x @ %s: %s\n", 547 dprintk(1,"probe 0x%02x @ %s: %s\n",
545 probe[i], adap->name, 548 probe[i], adap->name,
546 (0 == rc) ? "yes" : "no"); 549 (0 == rc) ? "yes" : "no");
547 if (0 == rc) { 550 if (0 == rc) {
548 ir_attach(adap,probe[i],0,0); 551 ir_attach(adap, probe[i], 0, 0);
549 break; 552 break;
550 } 553 }
551 } 554 }
555 kfree(c);
552 return 0; 556 return 0;
553} 557}
554 558