zero initialize stack allocated register structs
Avoid writing unintentional bits when using stack allocated register
structs.
Change-Id: I427f8449f15a8118883cfd7214aabe30dd6372d6
diff --git a/src/ethosu_device.c b/src/ethosu_device.c
index 404a0e7..9cb67ce 100644
--- a/src/ethosu_device.c
+++ b/src/ethosu_device.c
@@ -156,8 +156,8 @@
#if !defined(ARM_NPU_STUB)
struct cmd_r oldcmd;
oldcmd.word = ethosu_read_reg(dev, NPU_REG_CMD);
-
struct cmd_r cmd;
+
cmd.word = 0;
cmd.clear_irq = 1;
cmd.clock_q_enable = oldcmd.clock_q_enable;
@@ -299,6 +299,7 @@
{
#if !defined(ARM_NPU_STUB)
struct axi_limit0_r axi_limit0;
+ axi_limit0.word = 0;
axi_limit0.max_beats = max_beats;
axi_limit0.memtype = memtype;
axi_limit0.max_outstanding_read_m1 = max_reads - 1;
@@ -325,6 +326,7 @@
{
#if !defined(ARM_NPU_STUB)
struct axi_limit1_r axi_limit1;
+ axi_limit1.word = 0;
axi_limit1.max_beats = max_beats;
axi_limit1.memtype = memtype;
axi_limit1.max_outstanding_read_m1 = max_reads - 1;
@@ -351,6 +353,7 @@
{
#if !defined(ARM_NPU_STUB)
struct axi_limit2_r axi_limit2;
+ axi_limit2.word = 0;
axi_limit2.max_beats = max_beats;
axi_limit2.memtype = memtype;
axi_limit2.max_outstanding_read_m1 = max_reads - 1;
@@ -377,6 +380,7 @@
{
#if !defined(ARM_NPU_STUB)
struct axi_limit3_r axi_limit3;
+ axi_limit3.word = 0;
axi_limit3.max_beats = max_beats;
axi_limit3.memtype = memtype;
axi_limit3.max_outstanding_read_m1 = max_reads - 1;