[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181126125656.GF10650@smile.fi.intel.com>
Date: Mon, 26 Nov 2018 14:56:56 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Rob Herring <robh@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH v3 1/3] device property: Introduce fwnode_get_name()
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
Powered by blists - more mailing lists