diff options
author | Andrey Smirnov <[email protected]> | 2019-08-12 13:08:53 -0700 |
---|---|---|
committer | Wim Van Sebroeck <[email protected]> | 2019-09-17 08:59:05 +0200 |
commit | e6bd448653d61d17ddf9a663ca84d1f422846907 (patch) | |
tree | ec12fa784b5894855c7467c7b8b6ed0ee6b8c2e3 | |
parent | dc0dd28951f16be9714e90468e14566d186a7388 (diff) |
watchdog: ziirave_wdt: Fix incorrect use of ARRAY_SIZE
Both memset() and ziirave_firm_write_block_data() expect length in
bytes as an argument, not a number of elements in array. It just
happens that in this particular case both values are equal. Modify the
code to use sizeof() instead.
Signed-off-by: Andrey Smirnov <[email protected]>
Cc: Chris Healy <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Rick Ramstetter <[email protected]>
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Guenter Roeck <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
-rw-r--r-- | drivers/watchdog/ziirave_wdt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/watchdog/ziirave_wdt.c b/drivers/watchdog/ziirave_wdt.c index 19da0910c2d1..e0f55cbdc603 100644 --- a/drivers/watchdog/ziirave_wdt.c +++ b/drivers/watchdog/ziirave_wdt.c @@ -203,7 +203,7 @@ static int ziirave_firm_set_read_addr(struct watchdog_device *wdd, u16 addr) return i2c_smbus_write_block_data(client, ZIIRAVE_CMD_DOWNLOAD_SET_READ_ADDR, - ARRAY_SIZE(address), address); + sizeof(address), address); } static int ziirave_firm_write_block_data(struct watchdog_device *wdd, @@ -260,7 +260,7 @@ static int __ziirave_firm_write_pkt(struct watchdog_device *wdd, return -EMSGSIZE; } - memset(packet, 0, ARRAY_SIZE(packet)); + memset(packet, 0, sizeof(packet)); /* Packet length */ packet[0] = len; @@ -276,7 +276,7 @@ static int __ziirave_firm_write_pkt(struct watchdog_device *wdd, packet[ZIIRAVE_FIRM_PKT_TOTAL_SIZE - 1] = checksum; ret = ziirave_firm_write_block_data(wdd, ZIIRAVE_CMD_DOWNLOAD_PACKET, - ARRAY_SIZE(packet), packet, true); + sizeof(packet), packet, true); if (ret) dev_err(&client->dev, "Failed to write firmware packet at address 0x%04x: %d\n", |