linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Martin Kepplinger <martin.kepplinger@puri.sm>
Cc: Jonathan Cameron <jic23@kernel.org>,
	lorenzo.bianconi@redhat.com, linux-iio@vger.kernel.org
Subject: Re: [BUG] Re: [PATCH] iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1
Date: Thu, 29 Aug 2019 10:37:14 +0200	[thread overview]
Message-ID: <20190829083714.GA2880@localhost.localdomain> (raw)
In-Reply-To: <37cb0888-50b6-40d2-1289-a78499a90b7c@puri.sm>

[-- Attachment #1: Type: text/plain, Size: 2299 bytes --]

> On 27.08.19 22:08, Jonathan Cameron wrote:
> > On Tue, 27 Aug 2019 10:26:35 +0200
> > Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> > 
> >> Get rid of invalid sensitivity value for LSM9DS1 gyro sensor
> >>
> >> Fixes: 687a60feb9c6 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1")
> >> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > The zero degree scale is certainly odd otherwise, so good to tidy
> > this up.
> > 
> > Applied to the togreg branch of iio.git.
> > 
> 
> Hi Jon,
> 
> you have applied this too quickly. I've left that zero value in there
> for a reason, see below:
> 
> 
> > Thanks,
> > 
> > Jonathan
> > 
> >> ---

[...]

> 
> You Ooops here and it's pretty obvious! You don't have
> ST_LSM6DSX_FS_LIST_SIZE number of elements in the array anymore, but you
> try to access it (the 4th).

Hi Martin,

according to pahole (x86_64): 

struct st_lsm6dsx_fs {
	 [...]
	 /* size: 8, cachelines: 1, members: 2 *
};

struct st_lsm6dsx_fs_table_entry {
	[...]
	struct st_lsm6dsx_fs fs_avl[4];                  /*     4    32 */
	/* size: 36, cachelines: 1, members: 2 */
};

struct st_lsm6dsx_settings {
	[...]
	struct st_lsm6dsx_fs_table_entry fs_table[2];    /*   284    72 */
	/* size: 464, cachelines: 8, members: 14 */
};

struct st_lsm6dsx_fs_table_entry in st_lsm6dsx_settings will always have 4
elements for fs_avl array and since the array is defined as static the
uninitialized elements are set to 0.

Could you please share the ops you are getting?

Regards,
Lorenzo

> 
> I suggest reverting this (if not able to delete it entirely) and start
> over in case this "invalid" value thing hurts and needs to get fixed.
> 
> I any case, there _is_ something we should do because it's not too
> obvious what constraints the st_lsm6dsx_sensor_settings struct
> definition has. It should be mostly clear when looking at the header but
> a few inline comments might help.
> 
> thanks,
> 
>                           martin
> 
> 
> 
> >> +
> >>  		len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ",
> >> -				 hw->settings->fs_table[id].fs_avl[i].gain);
> >> +				 fs_table->fs_avl[i].gain);
> >> +	}
> >>  	buf[len - 1] = '\n';
> >>  
> >>  	return len;
> > 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2019-08-29  8:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27  8:26 [PATCH] iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1 Lorenzo Bianconi
2019-08-27 20:08 ` Jonathan Cameron
2019-08-29  5:27   ` [BUG] " Martin Kepplinger
2019-08-29  5:50     ` [PATCH] Revert "iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1" Martin Kepplinger
2019-08-29  8:37     ` Lorenzo Bianconi [this message]
2019-08-30  6:01       ` [BUG] Re: [PATCH] iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1 Martin Kepplinger
2019-08-30  7:23         ` Lorenzo Bianconi
2019-08-30 12:53           ` Martin Kepplinger
2019-08-31  9:32             ` Lorenzo Bianconi
2019-09-01 14:50               ` Jonathan Cameron
2019-09-03  5:22                 ` Martin Kepplinger
2019-09-03 12:37                   ` Jonathan Cameron

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=20190829083714.GA2880@localhost.localdomain \
    --to=lorenzo@kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=martin.kepplinger@puri.sm \
    /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;
as well as URLs for NNTP newsgroup(s).