Re: [PATCH v4 3/5] nvmem: rockchip-otp: Derive MAC addresses from the CPU ID

From: Andrew Lunn

Date: Wed Nov 25 2026 - 09:21:47 EST


> > +static int rockchip_otp_cpuid_pp(void *priv, const char *id, int index,
> > + unsigned int offset, void *buf, size_t bytes)
> > +{
> > + char cpuid[ROCKCHIP_CPUID_LEN * 2];
> > + u8 digest[SHA256_DIGEST_SIZE];
> > + u8 *mac = buf;
> > +
> > + if (!id || strcmp(id, "mac-address"))
> > + return 0;

I don't know OTP drivers. But to me, a function called
rockchip_otp_cpuid_pp() which does not actually return the CPU ID is
architecturally wrong.

I would probably not mangle the CPU ID in the OTP driver, but in the
MAC driver. The MAC driver should ask for the CPU ID and then hash it.

Andrew