This looks like an endianness conversion (I can not tell if this is
big to little or the opposite)...
Oopsy! On second look, this is an open coded cpu to big endian
conversion. So the question I should have asked is:
why not use the put_unaligned_be16() helper here?
Below comments still remain.
+ }
+ ether_addr_copy(nfc->fs.h_u.ether_spec.h_dest, da);
+
+ for (i = 0; i < sizeof(da) / 2; i++) {
+ ret = bcm_phy_read_exp(phydev,
+ BCM54XX_WOL_MASK(2 - i));
+ if (ret < 0)
+ return ret;
+
+ da[i * 2] = ~(ret >> 8);
+ da[i * 2 + 1] = ~(ret & 0xff);
+ }
+ ether_addr_copy(nfc->fs.m_u.ether_spec.h_dest, da);
+
+ ret = bcm_phy_read_exp(phydev, BCM54XX_WOL_INNER_PROTO);
+ if (ret < 0)
+ return ret;
+
+ nfc->fs.h_u.ether_spec.h_proto = be16_to_cpu(ret);
... but here it is big endian to cpu endian? It does not look coherent.
Also, did you run parse to check your endianness conversions?
https://www.kernel.org/doc/html/latest/dev-tools/sparse.html
For example, I would have expected htons() (a.k.a. cpu_to_be16())
instead of be16_to_cpu().
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature