Message ID | 20211013183601.16514-4-nirmoy.das@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2,1/4] dri: do not check for NULL debugfs dentry | expand |
On Wed, Oct 13, 2021 at 08:36:01PM +0200, Nirmoy Das wrote: > Debugfs APIs returns encoded error on failure so use > debugfs_lookup() instead of checking for NULL. The commit message no longer matches up with the patch itself (debugfs_lookup() isn't called). My suggestion would be something like: Retry creation of the vga_switcheroo debugfs if a previous invocation of debugfs_create_dir() returned an error code. With that addressed, Reviewed-by: Lukas Wunner <lukas@wunner.de> Thanks, Lukas > Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> > --- > drivers/gpu/vga/vga_switcheroo.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c > index 365e6ddbe90f..07ab8d85e899 100644 > --- a/drivers/gpu/vga/vga_switcheroo.c > +++ b/drivers/gpu/vga/vga_switcheroo.c > @@ -914,7 +914,7 @@ static void vga_switcheroo_debugfs_fini(struct vgasr_priv *priv) > static void vga_switcheroo_debugfs_init(struct vgasr_priv *priv) > { > /* already initialised */ > - if (priv->debugfs_root) > + if (priv->debugfs_root && !IS_ERR(priv->debugfs_root)) > return; > > priv->debugfs_root = debugfs_create_dir("vgaswitcheroo", NULL); > -- > 2.32.0
On 10/17/2021 10:03 PM, Lukas Wunner wrote: > On Wed, Oct 13, 2021 at 08:36:01PM +0200, Nirmoy Das wrote: >> Debugfs APIs returns encoded error on failure so use >> debugfs_lookup() instead of checking for NULL. > The commit message no longer matches up with the patch itself > (debugfs_lookup() isn't called). > > My suggestion would be something like: > > Retry creation of the vga_switcheroo debugfs if a previous > invocation of debugfs_create_dir() returned an error code. > > With that addressed, > Reviewed-by: Lukas Wunner <lukas@wunner.de> Thanks, Lukas. Yes, I missed that commit message modification. Nirmoy > > Thanks, > > Lukas > >> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> >> --- >> drivers/gpu/vga/vga_switcheroo.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c >> index 365e6ddbe90f..07ab8d85e899 100644 >> --- a/drivers/gpu/vga/vga_switcheroo.c >> +++ b/drivers/gpu/vga/vga_switcheroo.c >> @@ -914,7 +914,7 @@ static void vga_switcheroo_debugfs_fini(struct vgasr_priv *priv) >> static void vga_switcheroo_debugfs_init(struct vgasr_priv *priv) >> { >> /* already initialised */ >> - if (priv->debugfs_root) >> + if (priv->debugfs_root && !IS_ERR(priv->debugfs_root)) >> return; >> >> priv->debugfs_root = debugfs_create_dir("vgaswitcheroo", NULL); >> -- >> 2.32.0
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index 365e6ddbe90f..07ab8d85e899 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c @@ -914,7 +914,7 @@ static void vga_switcheroo_debugfs_fini(struct vgasr_priv *priv) static void vga_switcheroo_debugfs_init(struct vgasr_priv *priv) { /* already initialised */ - if (priv->debugfs_root) + if (priv->debugfs_root && !IS_ERR(priv->debugfs_root)) return; priv->debugfs_root = debugfs_create_dir("vgaswitcheroo", NULL);
Debugfs APIs returns encoded error on failure so use debugfs_lookup() instead of checking for NULL. CC: Lukas Wunner <lukas@wunner.de> CC: David Airlie <airlied@linux.ie> CC: Daniel Vetter <daniel@ffwll.ch> CC: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> CC: Maxime Ripard <mripard@kernel.org> CC: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> --- drivers/gpu/vga/vga_switcheroo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.32.0