Message ID | 20220202123248.36955-1-joel@jms.id.au |
---|---|
State | New |
Headers | show |
Series | [libgpiod] core: Fix gpiod_line_bulk_reset type | expand |
On Wed, Feb 2, 2022 at 1:33 PM Joel Stanley <joel@jms.id.au> wrote: > > bulk->lines is an array of pointers, so it doesn't matter which pointer > type we specify to sizeof(). As it's a struct gpiod_line *, it would > make sense to use that. > > Signed-off-by: Joel Stanley <joel@jms.id.au> > --- > > Alternately, we could make this sizeof(*bulk->lines). > > lib/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/core.c b/lib/core.c > index 2e7ee4b5b896..6ef09baec0f5 100644 > --- a/lib/core.c > +++ b/lib/core.c > @@ -117,7 +117,7 @@ GPIOD_API struct gpiod_line_bulk *gpiod_line_bulk_new(unsigned int max_lines) > GPIOD_API void gpiod_line_bulk_reset(struct gpiod_line_bulk *bulk) > { > bulk->num_lines = 0; > - memset(bulk->lines, 0, bulk->max_lines * sizeof(struct line *)); > + memset(bulk->lines, 0, bulk->max_lines * sizeof(struct gpiod_line *)); > } > > GPIOD_API void gpiod_line_bulk_free(struct gpiod_line_bulk *bulk) > -- > 2.34.1 > Applied, thanks! Bart
diff --git a/lib/core.c b/lib/core.c index 2e7ee4b5b896..6ef09baec0f5 100644 --- a/lib/core.c +++ b/lib/core.c @@ -117,7 +117,7 @@ GPIOD_API struct gpiod_line_bulk *gpiod_line_bulk_new(unsigned int max_lines) GPIOD_API void gpiod_line_bulk_reset(struct gpiod_line_bulk *bulk) { bulk->num_lines = 0; - memset(bulk->lines, 0, bulk->max_lines * sizeof(struct line *)); + memset(bulk->lines, 0, bulk->max_lines * sizeof(struct gpiod_line *)); } GPIOD_API void gpiod_line_bulk_free(struct gpiod_line_bulk *bulk)
bulk->lines is an array of pointers, so it doesn't matter which pointer type we specify to sizeof(). As it's a struct gpiod_line *, it would make sense to use that. Signed-off-by: Joel Stanley <joel@jms.id.au> --- Alternately, we could make this sizeof(*bulk->lines). lib/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)