diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index dfb2548e00529cc14ca60e5188cb13b91b481ce7..59b830a5ddf8e62b1ee20558e904334dbc0ad7b2 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -1514,7 +1514,6 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app) static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) { struct mt_device *td = hid_get_drvdata(hdev); - char *name; const char *suffix = NULL; unsigned int application = 0; struct mt_report_data *rdata; @@ -1581,13 +1580,10 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) } if (suffix) { - name = devm_kzalloc(&hi->input->dev, - strlen(hdev->name) + strlen(suffix) + 2, - GFP_KERNEL); - if (name) { - sprintf(name, "%s %s", hdev->name, suffix); - hi->input->name = name; - } + hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL, + "%s %s", hdev->name, suffix); + if (!hi->input->name) + return -ENOMEM; } return 0;