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

Andrew Lunn andrew at lunn.ch
Wed Nov 25 06:21:00 PST 2026


> > +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



More information about the Linux-rockchip mailing list