Commit bf952e0e authored by Vaibhav Gupta's avatar Vaibhav Gupta

[Fix]: software: kernel: ft-debug: The code returns false failure

After this:
	commit b208e2f7 ("software: kernel:
	ft-debug: Update API 'debugfs_create_regset32'")

The pointer `ft->dbg_reg` was never initialized. And when we
check it for "IS_ERR_ORNULL", we get false failure.

Thus, put conditional directive for this API update.
Signed-off-by: 's avatarVaibhav Gupta <vaibhav.gupta@cern.ch>
parent 711bde0f
......@@ -58,14 +58,20 @@ int ft_debug_init(struct fmctdc_dev *ft)
ft->dbg_reg32.regs = ft_debugfs_reg32;
ft->dbg_reg32.nregs = ARRAY_SIZE(ft_debugfs_reg32);
ft->dbg_reg32.base = ft->ft_base;
#if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE
debugfs_create_regset32("regs", 0444, ft->dbg_dir,
&ft->dbg_reg32);
#else
ft->dbg_reg = debugfs_create_regset32("regs", 0444,
ft->dbg_dir,
&ft->dbg_reg32);
if (IS_ERR_OR_NULL(ft->dbg_reg)) {
err = PTR_ERR(ft->dbg_reg);
dev_warn(&ft->pdev->dev,
"Cannot create debugfs file \"regs\" (%d)\n",
err);
}
#endif
break;
default:
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment