base: soc: Make soc_device_match() simpler and easier to read
authorGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 1 Mar 2022 11:10:35 +0000 (12:10 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Mar 2022 13:28:07 +0000 (14:28 +0100)
commitb0f6807d35667faae6de5e23ceffa4546c209bc8
treea356ad3a56ed78a6711b50fb673dd1ecce891210
parentf2aad54703dbe630f9d8b235eb58e8c8cc78f37d
base: soc: Make soc_device_match() simpler and easier to read

The function soc_device_match() is difficult to read for various
reasons:
  - There are two loop conditions using different styles: "while (...)"
    (which is BTW always true) vs. "if ... break",
  - The are two return condition using different logic: "if ... return
    foo" vs. "if ... else return bar".

Make the code easier to read by:
  1. Removing the always-true "!ret" loop condition, and dropping the
     now unneeded pre-initialization of "ret",
  2. Converting "if ... break" to a proper "while (...)" loop condition,
  3. Inverting the logic of the second return condition.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/9f9107c06f7d065ae6581e5290ef5d72f7298fd1.1646132835.git.geert+renesas@glider.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/soc.c