From: William Breathitt Gray <william.gray@linaro.org>
To: linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mranostay@ti.com,
jpanis@baylibre.com, gwendal@chromium.org, bleung@chromium.org,
groeck@chromium.org, jic23@kernel.org, david@lechnology.com,
robertcnelson@gmail.com
Subject: Re: [PATCH v2 4/4] counter: Introduce the COUNTER_COMP_ARRAY component type
Date: Sat, 17 Sep 2022 08:30:28 -0400 [thread overview]
Message-ID: <YyW95IoDkZl70V4a@fedora> (raw)
In-Reply-To: <f35ffc511f78148a10eb73b7d8abbe6c5d676973.1663372750.git.william.gray@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 946 bytes --]
On Fri, Sep 16, 2022 at 08:39:28PM -0400, William Breathitt Gray wrote:
> +static int counter_array_attrs_create(struct device *const dev,
> + struct counter_attribute_group *const group,
> + const struct counter_comp *const comp,
> + const enum counter_scope scope,
> + void *const parent, const size_t id)
> +{
> + const struct counter_array *const array = comp->priv;
> + struct counter_comp ext = *comp;
> + struct counter_array *element;
> + size_t idx;
> + int err;
> +
> + /* Create an attribute for each array element */
> + for (idx = 0; idx < array->length; idx++) {
> + /* Set index for array element extension */
> + element = ext.priv;
> + element->idx = idx;
This is unintentionally overwriting the array length and thus skipping
the subsequent array elements. Instead, element should be a copy of the
array rather than a pointer to it. I'll fix this in a v3 release.
William Breathitt Gray
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2022-09-17 12:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-17 0:39 [PATCH v2 0/4] Add support for Counter array components William Breathitt Gray
2022-09-17 0:39 ` [PATCH v2 1/4] counter: Introduce the Signal polarity component William Breathitt Gray
2022-09-17 0:39 ` [PATCH v2 2/4] counter: 104-quad-8: Add " William Breathitt Gray
2022-09-17 0:39 ` [PATCH v2 3/4] counter: Consolidate Counter extension sysfs attribute creation William Breathitt Gray
2022-09-17 0:39 ` [PATCH v2 4/4] counter: Introduce the COUNTER_COMP_ARRAY component type William Breathitt Gray
2022-09-17 12:30 ` William Breathitt Gray [this message]
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=YyW95IoDkZl70V4a@fedora \
--to=william.gray@linaro.org \
--cc=bleung@chromium.org \
--cc=david@lechnology.com \
--cc=groeck@chromium.org \
--cc=gwendal@chromium.org \
--cc=jic23@kernel.org \
--cc=jpanis@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mranostay@ti.com \
--cc=robertcnelson@gmail.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