Re: [PATCH] regmap: debugfs: Do not print warning when no device is associated

From: Mark Brown
Date: Mon Mar 05 2018 - 11:17:47 EST


On Fri, Mar 02, 2018 at 04:12:40PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@xxxxxxx>

> Commit 9b947a13e7f6 ("regmap: use debugfs even when no device")
> allows the usage of regmap debugfs even when there is no device
> associated, which causes several warnings like this:

> (NULL device *): Failed to create debugfs directory

> Do not print the warning in the case there is no associated device.

> map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
> if (!map->debugfs) {
> - dev_warn(map->dev, "Failed to create debugfs directory\n");
> + if (map->dev)
> + dev_warn(map->dev,
> + "Failed to create debugfs directory\n");

This then means that we will just randomly not create a debugfs for
anything except the first device that tries to do so with no device
which doesn't seem right. We should try harder to create a name here,
for example we could try printing the pointer to the map. Or keep a
counter and use dummy0 and so on.

Attachment: signature.asc
Description: PGP signature