31 Mar
2016
31 Mar
'16
2 p.m.
On 03/31/2016 10:58 AM, han.lu@intel.com wrote: [...]
- name_size = strlen(card->name) + strlen(card->driver_name)
+ strlen(vendor) + strlen(firmware) + 4;
- if (buf_size < name_size + strlen(card->snd_card->components))
return -ENOMEM;
- name = kmalloc(buf_size, GFP_KERNEL);
- if (!name)
return -ENOMEM;
- snprintf(name, buf_size, "%s:%s:%s:%s", card->name,
card->driver_name, vendor, firmware);
Have a look at kasprintf(). It will allow you to simplify the code here