Skip to content
Commit 7bbcf7e1 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Jonathan Cameron
Browse files

iio: Avoid unnecessary kasprintf



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: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 77bfa8ba
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