Commit a31e0f89 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: jr3_pci: use kasprintf

kasprintf combines kmalloc and sprintf, and takes care of the size
calculation itself.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cb560c40
......@@ -101,15 +101,11 @@ static int comedi_load_firmware(struct comedi_device *dev, const char *name,
int result = 0;
const struct firmware *fw;
char *firmware_path;
static const char *prefix = "comedi/";
firmware_path = kmalloc(strlen(prefix) + strlen(name) + 1, GFP_KERNEL);
firmware_path = kasprintf(GFP_KERNEL, "comedi/%s", name);
if (!firmware_path) {
result = -ENOMEM;
} else {
firmware_path[0] = '\0';
strcat(firmware_path, prefix);
strcat(firmware_path, name);
result = request_firmware(&fw, firmware_path, &pcidev->dev);
if (result == 0) {
if (!cb)
......
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