Thread (2 messages) 2 messages, 2 authors, 2025-12-21

Re: [RFC PATCH net-next v4 2/3] net: stmmac: Add glue driver for Motorcomm YT6801 ethernet controller

flat view

From: Andrew Lunn <andrew@lunn.ch>
Date: 2025-12-21 20:42:38
Also in: lkml

quoted hunk ↗ jump to hunk
+static int motorcomm_efuse_read_patch(struct dwmac_motorcomm_priv *priv,
+				      u8 index,
+				      struct motorcomm_efuse_patch *patch)
+{
+	u8 buf[sizeof(*patch)], offset;
+	int i, ret;
+
+	for (i = 0; i < sizeof(*patch); i++) {
+		offset = EFUSE_PATCH_REGION_OFFSET + sizeof(*patch) * index + i;
+
+		ret = motorcomm_efuse_read_byte(priv, offset, &buf[i]);
+		if (ret)
+			return ret;
+	}
+
+	memcpy(patch, buf, sizeof(*patch));
Why do you write it into a temporary buffer and then copy it to patch?
Why not put it straight into patch?
quoted hunk ↗ jump to hunk
+	ret = motorcomm_efuse_read_mac(priv, res.mac);
+	if (ret == -ENOENT) {
+		dev_warn(&pdev->dev, "eFuse contains no valid MAC address\n");
+		dev_warn(&pdev->dev, "fallback to random MAC address\n");
+
+		memset(res.mac, 0, sizeof(res.mac));
It is not clear how setting this to zero results in a random MAC
address. Maybe actually call eth_random_addr()?

	 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