From 9b40e459a19ab901b0958b051d02893af4454245 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 11 Jul 2023 11:59:16 +0100 Subject: [PATCH] nvdla: kmd: Fix compilation error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building the DLA KMD driver with GCC 13 the following error is observed ... drivers/video/tegra/host/nvdla/nvdla.c: In function ‘nvdla_remove’: drivers/video/tegra/host/nvdla/nvdla.c:1229:13: error: the comparison will always evaluate as ‘true’ for the address of ‘clk_cap_kobj’ will never be NULL [-Werror=address] 1229 | 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 Change-Id: I8200155b4c0becab51924bcb4357c30163f62666 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2934411 Tested-by: Ninad Malwade Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Ninad Malwade Reviewed-by: Amit Sharma (SW-TEGRA) Reviewed-by: Arvind M GVS: Gerrit_Virtual_Submit --- drivers/video/tegra/host/nvdla/nvdla.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/tegra/host/nvdla/nvdla.c b/drivers/video/tegra/host/nvdla/nvdla.c index f23b4bd1..45bc1da4 100644 --- a/drivers/video/tegra/host/nvdla/nvdla.c +++ b/drivers/video/tegra/host/nvdla/nvdla.c @@ -1226,7 +1226,7 @@ static int __exit nvdla_remove(struct platform_device *pdev) int i; struct kobj_attribute *attr = NULL; - if (&pdata->clk_cap_kobj) { + if (pdata->clk_cap_attrs) { for (i = 0; i < pdata->num_clks; i++) { attr = &pdata->clk_cap_attrs[i]; sysfs_remove_file(&pdata->clk_cap_kobj, &attr->attr);