drivers: pva: Fix compilation error

When building the PVA driver with GCC 13 the following error is
observed ...

 drivers/video/tegra/host/pva/pva.c:1366:13:
  error: the comparison will always evaluate as ‘true’ for the address
  of ‘clk_cap_kobj’ will never be NULL [-Werror=address]
 1366 |         if (&pdata->clk_cap_kobj) {
      |             ^

The 'clk_cap_kobj' member of 'nvhost_device_data' structure is not a
pointer to a structure but a structure and so the address of the
structure is always true. Fix this by testing if the address of the
'clk_cap_attrs' member which is a pointer to memory that is
allocated.

Bug 4190030

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: Iafe0da2a59f55420aa96ebc985c5352dfbed9c74
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2934461
Reviewed-by: Omar Nemri <onemri@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2023-07-11 13:52:43 +01:00
committed by mobile promotions
parent 9b40e459a1
commit 74b186dc9e

View File

@@ -1363,7 +1363,7 @@ static int __exit pva_remove(struct platform_device *pdev)
#if !IS_ENABLED(CONFIG_TEGRA_GRHOST) #if !IS_ENABLED(CONFIG_TEGRA_GRHOST)
struct kobj_attribute *attr = NULL; struct kobj_attribute *attr = NULL;
if (&pdata->clk_cap_kobj) { if (pdata->clk_cap_attrs) {
for (i = 0; i < pdata->num_clks; i++) { for (i = 0; i < pdata->num_clks; i++) {
attr = &pdata->clk_cap_attrs[i]; attr = &pdata->clk_cap_attrs[i];
sysfs_remove_file(&pdata->clk_cap_kobj, &attr->attr); sysfs_remove_file(&pdata->clk_cap_kobj, &attr->attr);