regmap: Improve error handling
authorMario Six <mario.six@gdsys.cc>
Thu, 4 Oct 2018 07:00:43 +0000 (09:00 +0200)
committerSimon Glass <sjg@chromium.org>
Wed, 14 Nov 2018 17:16:27 +0000 (09:16 -0800)
commitb6f58bfd6d2ce35360d3993be8d07e494e33021e
treec45477f9b91d463c69c7bc4328aab47f882f3e6b
parent9b076095636b7def91ed6fd3f94383155057e962
regmap: Improve error handling

ofnode_read_simple_addr_cells may fail and return a negative error code.
Check for this when initializing regmaps.

Also check if both_len is zero, since this is perfectly possible, and
would lead to a division-by-zero further down the line.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
drivers/core/regmap.c