From: Dan Carpenter <error27@gmail.com>
To: Christopher Morgan <macromorgan@hotmail.com>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: [bug report] Input: add driver for Hynitron cstxxx touchscreens
Date: Tue, 15 Nov 2022 18:53:40 +0300 [thread overview]
Message-ID: <Y3O2BNEbd3aKWm7X@kadam> (raw)
In-Reply-To: <6373b1f3.170a0220.85a5b.3a48SMTPIN_ADDED_BROKEN@mx.google.com>
On Tue, Nov 15, 2022 at 03:36:18PM +0000, Christopher Morgan wrote:
> On Tue, Nov 15, 2022 at 03:43:39PM +0300, Dan Carpenter wrote:
> > [ I sent this a couple weeks back, but it turns out that mutt + msmtp
> > has been silently eating my emails instead of sending them so I'm
> > resending two weeks of email. -dan ]
> >
> > Hello Chris Morgan,
> >
> > The patch 66603243f528: "Input: add driver for Hynitron cstxxx
> > touchscreens" from Oct 28, 2022, leads to the following Smatch static
> > checker warning:
>
> Apologies, but I'm a surprisingly un-skilled programmer.
Heh. Every several years I realize that, "Nope. I still don't
understand pointers."
> I'll be happy to fix the bugs though I just want to make sure I
> understand the problem clearly first.
>
> >
> > drivers/input/touchscreen/hynitron_cstxxx.c:238 cst3xx_bootloader_enter()
> > error: uninitialized symbol 'tmp'.
> >
>
> Does this mean I need to set the inital value of the tmp variable to 0? Looking
> at the code more closely I'm assuming this is the issue because if it runs through
> the loop 5 times and errors each time it will exit the loop without setting a
> value for tmp.
Setting it to zero works. Although I had to look up that
CST3XX_BOOTLDR_CHK_VAL is not zero... But presumably the people who
know the code will understand that right away.
>
> > drivers/input/touchscreen/hynitron_cstxxx.c
> > 209 static int cst3xx_bootloader_enter(struct i2c_client *client)
> > 210 {
> > 211 int err;
> > 212 u8 retry;
> > 213 u32 tmp;
> > 214 unsigned char buf[3];
> > 215
> > 216 for (retry = 0; retry < 5; retry++) {
> > 217 hyn_reset_proc(client, (7 + retry));
> >
> > I would have changed this to a while (retry--) { loop except the retry
> > value probably matters here.
>
> Is that personal prefrence or guidance? The BSP driver did the incremental
> loop 5 times, so that's why I did it here.
>
Yeah. Just a personal preference. I was trying to avoid using the
number 5 twice... Never mind about what I said here. Just initialize
it to zero.
regards,
dan carpenter
prev parent reply other threads:[~2022-11-15 15:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 12:43 [bug report] Input: add driver for Hynitron cstxxx touchscreens Dan Carpenter
[not found] ` <6373b1f3.170a0220.85a5b.3a48SMTPIN_ADDED_BROKEN@mx.google.com>
2022-11-15 15:53 ` Dan Carpenter [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=Y3O2BNEbd3aKWm7X@kadam \
--to=error27@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=macromorgan@hotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.