summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2023-05-16 10:18:36 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2023-05-16 10:21:56 +0200
commitca267855c64957c8a1efd4e150b7ef0d31eca24e (patch)
treee85fd25deb389e808af867d55e0995c66a9a340b /drivers
parent10c07815dad55ae3cb24c568be562361439a6f48 (diff)
downloadbarebox-ca267855c64957c8a1efd4e150b7ef0d31eca24e.tar.gz
barebox-ca267855c64957c8a1efd4e150b7ef0d31eca24e.tar.xz
i.MX: HABv4: Hide NULL pointers from optimizer
We are derefencing pointers which are in the zero page, consequently gcc warns us with: drivers/hab/habv4.c: In function 'imx6_hab_get_status': drivers/hab/habv4.c:580:16: warning: array subscript 0 is outside array bounds of 'const struct habv4_rvt[0]' [-Warray-bounds] Yes, we really want to derefence these pointers, so silence the warning with OPTIMIZER_HIDE_VAR(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hab/habv4.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index 252e38f655..ca26773bf8 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -564,14 +564,17 @@ int imx6_hab_get_status(void)
const struct habv4_rvt *rvt;
rvt = (void *)HABV4_RVT_IMX6_OLD;
+ OPTIMIZER_HIDE_VAR(rvt);
if (rvt->header.tag == HAB_TAG_RVT)
return habv4_get_status(rvt);
rvt = (void *)HABV4_RVT_IMX6_NEW;
+ OPTIMIZER_HIDE_VAR(rvt);
if (rvt->header.tag == HAB_TAG_RVT)
return habv4_get_status(rvt);
rvt = (void *)HABV4_RVT_IMX6UL;
+ OPTIMIZER_HIDE_VAR(rvt);
if (rvt->header.tag == HAB_TAG_RVT)
return habv4_get_status(rvt);