• L
    iio: Avoid unnecessary kasprintf · 7bbcf7e1
    Lars-Peter Clausen 提交于
    name_format already contains the final name and no format characters. So the
    code basically reads:
    
    	dev_attr->attr.name = kstrdup(GFP_KERNEL, name_format);
    	if (dev_attr->attr.name == NULL)
    		...
    	kfree(name_format);
    
    Which means we can save one alloc and free pair per attribute name if we
    directly assign name_format to dev_attr->attr.name.
    
    The patch also renames name_format to name to denote that this is indeed the
    final name and has no format characters in it.
    Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: NJonathan Cameron <jic23@kernel.org>
    7bbcf7e1
industrialio-core.c 31.1 KB