Commit 1ee332ac authored by Arvind Yadav's avatar Arvind Yadav Committed by Mauro Carvalho Chehab

media: cx23885: Handle return value of kasprintf

kasprintf() can fail here and we must check its return value.
Signed-off-by: default avatarArvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent a17d2d6c
......@@ -340,14 +340,23 @@ int cx23885_input_init(struct cx23885_dev *dev)
kernel_ir->cx = dev;
kernel_ir->name = kasprintf(GFP_KERNEL, "cx23885 IR (%s)",
cx23885_boards[dev->board].name);
if (!kernel_ir->name) {
ret = -ENOMEM;
goto err_out_free;
}
kernel_ir->phys = kasprintf(GFP_KERNEL, "pci-%s/ir0",
pci_name(dev->pci));
if (!kernel_ir->phys) {
ret = -ENOMEM;
goto err_out_free_name;
}
/* input device */
rc = rc_allocate_device(RC_DRIVER_IR_RAW);
if (!rc) {
ret = -ENOMEM;
goto err_out_free;
goto err_out_free_phys;
}
kernel_ir->rc = rc;
......@@ -382,9 +391,11 @@ int cx23885_input_init(struct cx23885_dev *dev)
cx23885_input_ir_stop(dev);
dev->kernel_ir = NULL;
rc_free_device(rc);
err_out_free:
err_out_free_phys:
kfree(kernel_ir->phys);
err_out_free_name:
kfree(kernel_ir->name);
err_out_free:
kfree(kernel_ir);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment