Commit e06999c3 authored by Rakesh Sankaranarayanan's avatar Rakesh Sankaranarayanan Committed by David S. Miller
Browse files

net: dsa: microchip: add error checking for ksz_pwrite

Add status validation for port register write inside
lan937x_change_mtu. ksz_pwrite and ksz_pread api's are
updated with return type int (Reference patch mentioned
below). Update lan937x_change_mtu with status validation
for ksz_pwrite16().

Link: https://patchwork.kernel.org/project/netdevbpf/patch/20220826105634.3855578-6-o.rempel@pengutronix.de/



Signed-off-by: default avatarRakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a9c6db3b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -242,7 +242,11 @@ int lan937x_change_mtu(struct ksz_device *dev, int port, int new_mtu)
	}

	/* Write the frame size in PORT_MAX_FR_SIZE register */
	ksz_pwrite16(dev, port, PORT_MAX_FR_SIZE, new_mtu);
	ret = ksz_pwrite16(dev, port, PORT_MAX_FR_SIZE, new_mtu);
	if (ret) {
		dev_err(ds->dev, "failed to update mtu for port %d\n", port);
		return ret;
	}

	return 0;
}