From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
kbuild@lists.01.org, lkp@intel.com, kbuild-all@lists.01.org,
linux-input@vger.kernel.org,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [input:next 2732/2735] drivers/input/touchscreen/resistive-adc-touch.c:84 grts_cb() error: uninitialized symbol 'z2'.
Date: Tue, 1 Jun 2021 21:16:48 -0700 [thread overview]
Message-ID: <YLcGMNL1MoOVhhmv@google.com> (raw)
In-Reply-To: <20210601102715.uu2wflgzvrler6rt@pengutronix.de>
On Tue, Jun 01, 2021 at 12:27:15PM +0200, Oleksij Rempel wrote:
> Hi Dmitry,
>
>
> > Input: resistive-adc-touch - rework mapping of channels
> >
> > From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> >
> > Instead of iterating over channels establish and use channel map to
> > retrieve data. As a side effect this will silence "uninitialized variable"
> > warnings.
> >
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> > drivers/input/touchscreen/resistive-adc-touch.c | 114 ++++++++++-------------
> > 1 file changed, 51 insertions(+), 63 deletions(-)
> >
> > diff --git a/drivers/input/touchscreen/resistive-adc-touch.c b/drivers/input/touchscreen/resistive-adc-touch.c
> > index ea1884fb49a1..2102916a37ea 100644
> > --- a/drivers/input/touchscreen/resistive-adc-touch.c
> > +++ b/drivers/input/touchscreen/resistive-adc-touch.c
> > @@ -25,12 +25,12 @@
> > #define GRTS_MAX_CHANNELS 4
> >
> > enum grts_ch_type {
> > - GRTS_CH_NONE = 0,
> > GRTS_CH_X,
> > GRTS_CH_Y,
> > GRTS_CH_PRESSURE,
> > GRTS_CH_Z1,
> > GRTS_CH_Z2,
> > + GRTS_CH_MAX = GRTS_CH_Z2 + 1
> > };
> >
> > /**
> > @@ -42,7 +42,7 @@ enum grts_ch_type {
> > * @iio_cb: iio_callback buffer for the data
> > * @input: the input device structure that we register
> > * @prop: touchscreen properties struct
> > - * @ch: channels that are defined for the touchscreen
> > + * @ch_map: map of channels that are defined for the touchscreen
> > */
> > struct grts_state {
> > u32 x_plate_ohms;
> > @@ -52,37 +52,25 @@ struct grts_state {
> > struct iio_cb_buffer *iio_cb;
> > struct input_dev *input;
> > struct touchscreen_properties prop;
> > - u8 ch[GRTS_MAX_CHANNELS];
> > + u8 ch_map[GRTS_CH_MAX];
> > };
> >
> > static int grts_cb(const void *data, void *private)
> > {
> > const u16 *touch_info = data;
> > struct grts_state *st = private;
> > - unsigned int x, y, press = 0, z1 = 0, z2;
> > - unsigned int Rt, i;
> > -
> > - for (i = 0; i < ARRAY_SIZE(st->ch) && st->ch[i] != GRTS_CH_NONE; i++) {
> > - switch (st->ch[i]) {
> > - case GRTS_CH_X:
> > - x = touch_info[i];
> > - break;
> > - case GRTS_CH_Y:
> > - y = touch_info[i];
> > - break;
> > - case GRTS_CH_PRESSURE:
> > - press = touch_info[i];
> > - break;
> > - case GRTS_CH_Z1:
> > - z1 = touch_info[i];
> > - break;
> > - case GRTS_CH_Z2:
> > - z2 = touch_info[i];
> > - break;
> > - }
> > - }
> > + unsigned int x, y, press;
> > +
> > + x = touch_info[st->ch_map[GRTS_CH_X]];
> > + y = touch_info[st->ch_map[GRTS_CH_X]];
>
> Here should be GRTS_CH_Y
>
> With this fix:
> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Thank you Okeksij, I fixed this up and applied.
--
Dmitry
prev parent reply other threads:[~2021-06-02 4:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 9:30 [input:next 2732/2735] drivers/input/touchscreen/resistive-adc-touch.c:84 grts_cb() error: uninitialized symbol 'z2' Dan Carpenter
2021-05-27 10:19 ` Oleksij Rempel
2021-05-27 10:41 ` Dan Carpenter
2021-06-01 6:21 ` Dmitry Torokhov
2021-06-01 10:27 ` Oleksij Rempel
2021-06-02 4:16 ` Dmitry Torokhov [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=YLcGMNL1MoOVhhmv@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=dan.carpenter@oracle.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-input@vger.kernel.org \
--cc=lkp@intel.com \
--cc=o.rempel@pengutronix.de \
/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).