aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2017-09-20 03:37:13 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-08 10:40:39 -0500
commit1ee332acc6b5d1b4773bb5314b07938da5406e1e (patch)
treeb79db55ebff89c7d55a5064b04599ec279f82f2f
parenta17d2d6cd9985ca09a9e384f1bc71d710f7e5203 (diff)
media: cx23885: Handle return value of kasprintf
kasprintf() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/pci/cx23885/cx23885-input.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c
index 944b70831f12..0f4e54294bb7 100644
--- a/drivers/media/pci/cx23885/cx23885-input.c
+++ b/drivers/media/pci/cx23885/cx23885-input.c
@@ -340,14 +340,23 @@ int cx23885_input_init(struct cx23885_dev *dev)
340 kernel_ir->cx = dev; 340 kernel_ir->cx = dev;
341 kernel_ir->name = kasprintf(GFP_KERNEL, "cx23885 IR (%s)", 341 kernel_ir->name = kasprintf(GFP_KERNEL, "cx23885 IR (%s)",
342 cx23885_boards[dev->board].name); 342 cx23885_boards[dev->board].name);
343 if (!kernel_ir->name) {
344 ret = -ENOMEM;
345 goto err_out_free;
346 }
347
343 kernel_ir->phys = kasprintf(GFP_KERNEL, "pci-%s/ir0", 348 kernel_ir->phys = kasprintf(GFP_KERNEL, "pci-%s/ir0",
344 pci_name(dev->pci)); 349 pci_name(dev->pci));
350 if (!kernel_ir->phys) {
351 ret = -ENOMEM;
352 goto err_out_free_name;
353 }
345 354
346 /* input device */ 355 /* input device */
347 rc = rc_allocate_device(RC_DRIVER_IR_RAW); 356 rc = rc_allocate_device(RC_DRIVER_IR_RAW);
348 if (!rc) { 357 if (!rc) {
349 ret = -ENOMEM; 358 ret = -ENOMEM;
350 goto err_out_free; 359 goto err_out_free_phys;
351 } 360 }
352 361
353 kernel_ir->rc = rc; 362 kernel_ir->rc = rc;
@@ -382,9 +391,11 @@ err_out_stop:
382 cx23885_input_ir_stop(dev); 391 cx23885_input_ir_stop(dev);
383 dev->kernel_ir = NULL; 392 dev->kernel_ir = NULL;
384 rc_free_device(rc); 393 rc_free_device(rc);
385err_out_free: 394err_out_free_phys:
386 kfree(kernel_ir->phys); 395 kfree(kernel_ir->phys);
396err_out_free_name:
387 kfree(kernel_ir->name); 397 kfree(kernel_ir->name);
398err_out_free:
388 kfree(kernel_ir); 399 kfree(kernel_ir);
389 return ret; 400 return ret;
390} 401}