Messages in this thread | | | From | Geert Uytterhoeven <> | Date | Wed, 24 May 2023 08:40:07 +0200 | Subject | Re: [PATCH] regulator: core: Streamline debugfs operations |
| |
Hi Mark,
On Tue, May 23, 2023 at 5:16 PM Mark Brown <broonie@kernel.org> wrote: > On Tue, May 23, 2023 at 05:03:58PM +0200, Geert Uytterhoeven wrote: > > > - if (!regulator->debugfs) { > > + if (IS_ERR(regulator->debugfs)) > > rdev_dbg(rdev, "Failed to create debugfs directory\n"); > > - } else { > > - debugfs_create_u32("uA_load", 0444, regulator->debugfs, > > - ®ulator->uA_load); > > - } > > + > > + debugfs_create_u32("uA_load", 0444, regulator->debugfs, > > + ®ulator->uA_load); > > No, it's actually useful to not just dump these files in the root > directory if we fail to create the per regulator directory.
If regulator->debugfs is an error, no files are dumped in the root directory.
By design, all debugfs functions are no-ops when passed an error, cfr. the comment quoted above:
Other debugfs functions handle the fact that the "dentry" passed to them could be an error and they don't crash in that case.
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
| |