mfd: cs42l43: Update patching revision check
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Tue, 23 Apr 2024 10:23:39 +0000 (11:23 +0100)
committerLee Jones <lee@kernel.org>
Fri, 10 May 2024 14:39:17 +0000 (15:39 +0100)
commit20677b34cf326262f2ba0a5eccf66d07e30c760f
treebd4b6e1bb1d51a5db5704a41b05b19ccb0f92f61
parentaecebbc087161c09014dc1c3b66ca5fc8326f6f3
mfd: cs42l43: Update patching revision check

The firmware can only be patched once. The current code checks if the
firmware supports the features required by the driver and then patches
if it does not. This could lead to the device being patched twice if
the device was patched before the driver took control, but with a
firmware that doesn't support the features the driver requires. This
would fail but potentially in unpredictable ways.

The check should actually check the device is at the ROM version, and
patch the device if it is. Then a separate later check should error out
if the devices firmware is still too old to be supported. This will at
least fail in a clean way with a nice error message.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240423102339.2363400-1-ckeepax@opensource.cirrus.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/cs42l43.c