[PATCH v3 1/6] watchdog: wdt-uclass: rename str to svc_str in wdt_start()

Juuso Rinta <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
Rename the servicing string from str to svc_str in wdt_start(),
replace memset with svc_str[0] = '\0', and use sizeof(svc_str)
in snprintf.

Signed-off-by: Juuso Rinta <[email protected]>
---
 drivers/watchdog/wdt-uclass.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 438833b2245..cce874dc000 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -127,9 +127,9 @@ int wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
 	ret = ops->start(dev, timeout_ms, flags);
 	if (ret == 0) {
 		struct wdt_priv *priv = dev_get_uclass_priv(dev);
-		char str[16];
+		char svc_str[16];
 
-		memset(str, 0, 16);
+		svc_str[0] = '\0';
 		if (IS_ENABLED(CONFIG_WATCHDOG)) {
 			if (priv->running)
 				cyclic_unregister(&priv->cyclic);
@@ -139,13 +139,14 @@ int wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
 					priv->reset_period * 1000,
 					dev->name);
 
-			snprintf(str, 16, "every %ldms", priv->reset_period);
+			snprintf(svc_str, sizeof(svc_str), "every %ldms",
+				 priv->reset_period);
 		}
 
 		priv->running = true;
 		printf("WDT:   Started %s with%s servicing %s (%ds timeout)\n",
 		       dev->name, IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out",
-		       str, (u32)lldiv(timeout_ms, 1000));
+		       svc_str, (u32)lldiv(timeout_ms, 1000));
 	}
 
 	return ret;

-- 
2.39.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.