From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>,
linux-iio@vger.kernel.org
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] iio: core: Use an API instead of relying on a specific error code
Date: Tue, 24 Nov 2026 11:38:41 +0100 [thread overview]
Message-ID: <20261124103842.600399-1-andriy.shevchenko@linux.intel.com> (raw)
Use device_property_present() instead of relying on a specific error code
when parsing mount matrix to reliably detect absence of a property.
No functional changes intended.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/iio/industrialio-core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 3b66d7b765d5..5f9d6e852286 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -567,6 +567,10 @@ int iio_read_mount_matrix(struct device *dev, struct iio_mount_matrix *matrix)
size_t len = ARRAY_SIZE(iio_mount_idmatrix.rotation);
int err;
+ if (!device_property_present(dev, "mount-matrix"))
+ /* Matrix was not declared at all: fallback to identity. */
+ return iio_setup_mount_idmatrix(dev, matrix);
+
err = device_property_read_string_array(dev, "mount-matrix", matrix->rotation, len);
if (err == len)
return 0;
@@ -575,12 +579,8 @@ int iio_read_mount_matrix(struct device *dev, struct iio_mount_matrix *matrix)
/* Invalid number of matrix entries. */
return -EINVAL;
- if (err != -EINVAL)
- /* Invalid matrix declaration format. */
- return err;
-
- /* Matrix was not declared at all: fallback to identity. */
- return iio_setup_mount_idmatrix(dev, matrix);
+ /* Invalid matrix declaration format. */
+ return err;
}
EXPORT_SYMBOL(iio_read_mount_matrix);
--
2.50.1
next reply other threads:[~2026-11-24 11:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 10:38 Andy Shevchenko [this message]
2026-11-24 12:58 ` [PATCH v1 1/1] iio: core: Use an API instead of relying on a specific error code Joshua Crofts
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=20261124103842.600399-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=jonathan.cameron@oss.qualcomm.com \
--cc=linux-iio@vger.kernel.org \
--cc=nuno.sa@analog.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