This is useful when we want to use regmap with character devices.

Signed-off-by: Dimitris Papastamos <d...@opensource.wolfsonmicro.com>
---
 drivers/base/regmap/regmap-debugfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap-debugfs.c 
b/drivers/base/regmap/regmap-debugfs.c
index bb1ff17..c2fbf57 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -39,7 +39,10 @@ static ssize_t regmap_name_read_file(struct file *file,
        if (!buf)
                return -ENOMEM;
 
-       ret = snprintf(buf, PAGE_SIZE, "%s\n", map->dev->driver->name);
+       if (map->dev->driver && map->dev->driver->name)
+               ret = snprintf(buf, PAGE_SIZE, "%s\n", map->dev->driver->name);
+       else
+               ret = snprintf(buf, PAGE_SIZE, "%s\n", dev_name(map->dev));
        if (ret < 0) {
                kfree(buf);
                return ret;
-- 
1.7.11.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to