Thread (23 messages) flat view 23 messages, 3 authors, 6d ago

Re: [PATCH net-next v6 02/13] ax88179_178a: Split driver into library and device specific code

From: Birger Koblitz <hidden>
Date: 2026-08-09 03:39:57
Also in: linux-usb, lkml

On 09/08/2026 02:57, Jianhui Xu wrote:
Hi Birger,

I noticed what looks like a typo in the newly added `ax88179_read_cmd()`:
if (size == 2) {
	u16 buf = 0;

	ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf);
	le16_to_cpus(&buf);
	*((u16 *)data) = buf;
} else if (size == 2) {
	u32 buf = 0;

	ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf);
	le32_to_cpus(&buf);
	*((u32 *)data) = buf;
}
The second condition should presumably be:
} else if (size == 4) {
The original implementation before this code was moved to `ax88179_lib.c`
also used `else if (4 == size)`.

As written, the `u32` branch is unreachable, so 4-byte reads fall through
to `__ax88179_read_cmd()` without the `le32_to_cpus()` conversion.
Thanks Jianhui for reporting this. Indeed, this was a typo introduced when
updating the coding style for the original driver function that was copied to the
new library file. checkpatch complained about the old style.
Will fix to read (size == 4) in v7.

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