[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK8P3a3JvY=jcXGRRG+Eck2bkGRvb6_FTYZK+9RZS4Fw8y4eHA@mail.gmail.com>
Date: Tue, 1 Mar 2022 14:16:28 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Geert Uytterhoeven <geert+renesas@...der.be>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Lee Jones <lee.jones@...aro.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCH] base: soc: Make soc_device_match() simpler and easier to read
On Tue, Mar 1, 2022 at 12:10 PM Geert Uytterhoeven
<geert+renesas@...der.be> wrote:
>
> 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.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
> ---
Reviewed-by: Arnd Bergmann <arnd@...db.de>
Powered by blists - more mailing lists