Thread (8 messages) 8 messages, 2 authors, 2018-11-26

Re: [PATCH v3 1/3] device property: Introduce fwnode_get_name()

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2018-11-26 12:57:02
Also in: linux-acpi, lkml

On Mon, Nov 26, 2018 at 02:47:50PM +0300, Heikki Krogerus wrote:
This helper returns the name of the node. The name is
primarily expected to be returned from a new fwnode
operation meant for this purpose, but when no name is
returned, the helper will also attempt to read a device
property "name".
+int fwnode_get_name(const struct fwnode_handle *fwnode, char *buf, size_t len)
+{
+	const char *name;
+	int ret;
+
+	if (!fwnode_call_int_op(fwnode, get_name, buf, len))
+		return 0;
+
+	ret = fwnode_call_int_op(fwnode, property_read_string_array,
+				 "name", &name, 1);
+	if (!ret)
+		snprintf(buf, len, "%s", name);
What are we going to do in case snprintf has found no room for entire string?
+
+	return ret;
+}
-- 
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help