summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDavid Lechner <[email protected]>2026-05-06 18:05:31 -0500
committerDavid Lechner <[email protected]>2026-06-10 15:31:42 -0500
commit2258b6419a9fb94a62c566d7804fe4ff551fae7a (patch)
treed18fbfa9c2c2cac107edd191e8580af64ea31820 /drivers
parentb581ec125a9f97404d38b2b85aeb1065fcaa2539 (diff)
pinctrl: mediatek: use scnprintf() instead of snprintf()
Replace snprintf() with scnprintf() in the MediaTek pinctrl driver. snprintf() returns the number of characters that _would_ have been written if the buffer were large enough, while scnprintf() returns the number of characters actually written to the buffer. Since we use the return value to advance the buffer pointer, we need to use scnprintf() to have the correct pointer arithmetic. Fixes: 76da7482cf39 ("pinctrl: mediatek: print bias info along with pinmux") Reviewed-by: Julien Stephan <[email protected]> Link: https://patch.msgid.link/20260506-mtk-pinctrl-fix-scnprintf-v1-1-56b99d5809db@baylibre.com Signed-off-by: David Lechner <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mtk-common.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index cfffbaeef84..01f67f09407 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -251,7 +251,7 @@ static int mtk_pinconf_get(struct udevice *dev, u32 pin, char *buf, size_t size)
if (mtk_get_pin_io_type(dev, pin, &io_type))
return 0;
- pos = snprintf(buf, size, " (%s)", io_type.name);
+ pos = scnprintf(buf, size, " (%s)", io_type.name);
if (pos >= size)
return pos;
@@ -306,7 +306,7 @@ static int mtk_get_pin_muxing(struct udevice *dev, unsigned int selector,
if (err)
return err;
- pos = snprintf(buf, size, "Aux Func.%d", val);
+ pos = scnprintf(buf, size, "Aux Func.%d", val);
if (pos >= size)
return 0;
@@ -721,7 +721,7 @@ int mtk_pinconf_get_pu_pd(struct udevice *dev, u32 pin, char *buf, size_t size)
if (err)
return err;
- return snprintf(buf, size, " PU:%d PD:%d", pu, pd);
+ return scnprintf(buf, size, " PU:%d PD:%d", pu, pd);
}
int mtk_pinconf_get_pupd_r1_r0(struct udevice *dev, u32 pin, char *buf, size_t size)
@@ -740,7 +740,7 @@ int mtk_pinconf_get_pupd_r1_r0(struct udevice *dev, u32 pin, char *buf, size_t s
if (err)
return err;
- return snprintf(buf, size, " PUPD:%d R1:%d R0:%d", pupd, r1, r0);
+ return scnprintf(buf, size, " PUPD:%d R1:%d R0:%d", pupd, r1, r0);
}
int mtk_pinconf_get_pu_pd_rsel(struct udevice *dev, u32 pin, char *buf, size_t size)
@@ -755,7 +755,7 @@ int mtk_pinconf_get_pu_pd_rsel(struct udevice *dev, u32 pin, char *buf, size_t s
if (err)
return err;
- return pos + snprintf(buf + pos, size - pos, " RSEL:%d", rsel);
+ return pos + scnprintf(buf + pos, size - pos, " RSEL:%d", rsel);
}
#endif