PCI: endpoint: Simplify name allocation for EPF device
authorRolf Evers-Fischer <rolf.evers.fischer@aptiv.com>
Wed, 28 Feb 2018 17:32:18 +0000 (18:32 +0100)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 1 Mar 2018 11:58:18 +0000 (11:58 +0000)
commit36cc14ac14c0d49d33820a82dab52a7edc802fef
treee105a05c3ac92b47ff21872edb24f4eb1ea30746
parent7928b2cbe55b2a410a0f5c1f154610059c57b1b2
PCI: endpoint: Simplify name allocation for EPF device

This commit replaces allocating and freeing the intermediate
'buf'/'func_name' with a combination of 'kstrndup()' and 'len'.

'len' is the required length of 'epf->name'.
'epf->name' should be either the first part of 'name' preceding the '.'
or the complete 'name', if there is no '.' in the name.

Signed-off-by: Rolf Evers-Fischer <rolf.evers.fischer@aptiv.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
drivers/pci/endpoint/pci-epf-core.c