Skip to content

RFC Verify if register is writeable before a write operation

Han Nandor lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1regmap: verify if register is writeable before writing operationsdrivers/base/regmap/regmap.c+4 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/1] Verify if register is writeable before a write operation

Description
-----------
This is an RFC because I don't know if this is a bug or a normal use case. It seems that the function _regmap_raw_write_impl from the regmap framework verifies that a register is writable only using
the callback function, ignoring the other two (max allowed register, register ranges)

Note: As a left right look I did check also _regmap_raw_read function, and it seems that is missing this checks completely.
Is this a problem as well?

Device/Subsystems Impacted
-------------------------
This will impact drivers that end up using raw writes (firmware download, ...)

Testing
-------
Test configuration:
- Kernel Version: 4.14.60 (just for clarification, the patch is rebased on master)
- The testing was done using a driver that has NVMEM support and is using regmap_bulk_write method to write data to registers.
- The valid register range is 0x00->0xFF.

1. Configure a nvcell (4 bytes long) in DT which is outside the valid register range.
2. Write data to NVMEM using the nvcell
3. Verify the result:
3.1 Without the patch the data write in registers is successful with
no error displayed.
3.2 With the patch the data write is denied and an error is displayed.

Nandor Han (1):
regmap: verify if register is writeable before writing operations

 drivers/base/regmap/regmap.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.2