From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>
Subject: [PATCH v1 2/2] gpiolib: acpi: Check for errors first in acpi_find_gpio()
Date: Wed, 10 Apr 2024 23:21:47 +0300 [thread overview]
Message-ID: <20240410202243.1658129-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20240410202243.1658129-1-andriy.shevchenko@linux.intel.com>
It's better to parse the code when the usual pattern is being used,
i.e. checking for error condition first.
There is no functional or code generation change (tested in LLVM).
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpiolib-acpi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index f596edf89451..c2a33beeec50 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -973,10 +973,11 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
else
desc = acpi_get_gpiod_from_data(fwnode,
propname, idx, &info);
- if (!IS_ERR(desc))
- break;
if (PTR_ERR(desc) == -EPROBE_DEFER)
return ERR_CAST(desc);
+
+ if (!IS_ERR(desc))
+ break;
}
/* Then from plain _CRS GPIOs */
--
2.43.0.rc1.1336.g36b5255a03ac
next prev parent reply other threads:[~2024-04-10 20:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 20:21 [PATCH v1 0/2] gpiolib: acpi: A couple of error checks amendmends Andy Shevchenko
2024-04-10 20:21 ` [PATCH v1 1/2] gpiolib: acpi: Remove never true check in acpi_get_gpiod_by_index() Andy Shevchenko
2024-04-10 20:21 ` Andy Shevchenko [this message]
2024-04-11 13:28 ` [PATCH v1 0/2] gpiolib: acpi: A couple of error checks amendmends Mika Westerberg
2024-04-11 13:37 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240410202243.1658129-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=justinstitt@google.com \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mika.westerberg@linux.intel.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox