FAILED: patch "[PATCH] regmap: fix writes to non incrementing registers" failed to apply to 4.19-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 2e31aab08bad0d4ee3d3d890a7b74cb6293e0a41 Mon Sep 17 00:00:00 2001
From: Ben Whitten <[email protected]>
Date: Sat, 18 Jan 2020 20:56:24 +0000
Subject: [PATCH] regmap: fix writes to non incrementing registers
When checking if a register block is writable we must ensure that the block does not start with or contain a non incrementing register.
Fixes 8b9f9d4dc511 ("regmap: verify if register is writeable before writing operations")
Signed-off-by Ben Whitten <[email protected]>
Signed-off-by Mark Brown <[email protected]>
drivers/base/regmap/regmap.c +12 -5
@@ -1488,11 +1488,18 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,WARN_ON (!map->bus); -/* Check for unwritable registers before we start */ -for (i =0 ; i < val_len / map->format.val_bytes; i++) -if (!regmap_writeable (map, - reg +regmap_get_offset (map, i))) -return -EINVAL ; +/* Check for unwritable or noinc registers in range +* before we start +*/ +if (!regmap_writeable_noinc (map, reg)) { +for (i =0 ; i < val_len / map->format.val_bytes; i++) { +unsigned int element = + reg +regmap_get_offset (map, i); +if (!regmap_writeable (map, element) || +regmap_writeable_noinc (map, element)) +return -EINVAL ; + } + }if (!map->cache_bypass && map->format.parse_val) {unsigned int ival;