vi: Don't create debugfs node if base addr is NULL

A crash is observed when trying to access ch1 debugfs register in vi0
and vi1 folder. This is because the base reg address is not defined in
DT. This seems like an old legacy code which is ported over. The
registers accessed by this debugfs node are not longer directly
accessible using CCPLEX. While we wait on confirmation for this, adding
this check to not create debugfs node, if register base address is not
defined.

Bug 4626339

Change-Id: Ife714fa7e989bcaf187956920d757870e5fd9701
Signed-off-by: Mohit Ingale <mohiti@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3184450
(cherry picked from commit 1fb6c087c924a540b151183cb5be13311f2c4af1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3185971
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Mohit Ingale
2024-07-29 15:52:41 -07:00
committed by mobile promotions
parent 98be04181c
commit 3dfd89c75e

View File

@@ -458,13 +458,18 @@ static int vi5_init_debugfs(struct host_vi5 *vi5)
{ .name = "channel_count", 0x80 }, { .name = "channel_count", 0x80 },
}; };
struct nvhost_device_data *pdata = platform_get_drvdata(vi5->pdev); struct nvhost_device_data *pdata = platform_get_drvdata(vi5->pdev);
struct dentry *dir = pdata->debugfs;
struct vi5_debug *debug = &vi5->debug;
debug->ch0.base = pdata->aperture[0]; if (pdata->aperture[0]) {
debug->ch0.regs = vi5_ch_regs; struct dentry *dir = pdata->debugfs;
debug->ch0.nregs = ARRAY_SIZE(vi5_ch_regs); struct vi5_debug *debug = &vi5->debug;
debugfs_create_regset32("ch0", S_IRUGO, dir, &debug->ch0);
debug->ch0.base = pdata->aperture[0];
debug->ch0.regs = vi5_ch_regs;
debug->ch0.nregs = ARRAY_SIZE(vi5_ch_regs);
debugfs_create_regset32("ch0", 0444, dir, &debug->ch0);
} else {
dev_info(&vi5->pdev->dev, "Unable to create debugfs entry\n");
}
return 0; return 0;
} }