Thread (5 messages) flat view 5 messages, 3 authors, 26d ago

Re: [PATCH] net: pcs: rzn1-miic: Fix config array initialization

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-08-14 13:14:23
Also in: linux-renesas-soc, lkml

On Fri, Aug 14, 2026 at 10:11:28AM +0200, Geert Uytterhoeven wrote:
CC Prabhakar

On Thu, 13 Aug 2026 at 20:09, Kyle Hendry via B4 Relay
[off-list ref] wrote:
quoted
From: Kyle Hendry <redacted>

Fix memset parameters to initialize the entire DT value array

Signed-off-by: Kyle Hendry <redacted>
Fixes: f39e968dc168a7bd ("net: pcs: rzn1-miic: Move configuration data
to SoC-specific struct")
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
quoted
--- a/drivers/net/pcs/pcs-rzn1-miic.c
+++ b/drivers/net/pcs/pcs-rzn1-miic.c
@@ -683,7 +683,7 @@ static int miic_parse_dt(struct miic *miic, u32 *mode_cfg)
        if (!dt_val)
                return -ENOMEM;

-       memset(dt_val, MIIC_MODCTRL_CONF_NONE, sizeof(*dt_val));
+       memset(dt_val, MIIC_MODCTRL_CONF_NONE, miic->of_data->conf_conv_count);
Sorry for hijacking your reply, i already deleted the original email.

This is correct, but could maybe be better. dt_val is allocated with.

     kmalloc_objs(*dt_val, miic->of_data->conf_conv_count)

This allocates objects. It just happens your objects are s8, so size
of 1. But the memset() would be "more correct" with:

memset(dt_val, MIIC_MODCTRL_CONF_NONE, sizeof(*dt_val) * miic->of_data->conf_conv_count);

And i checked, there is no memset_objs().

       Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help