From: Charles Wang <charles.goodix@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: dmitry.torokhov@gmail.com, jikos@kernel.org, bentiss@kernel.org,
lkp@intel.com, oe-kbuild-all@lists.linux.dev,
hbarnor@chromium.org, dianders@chromium.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] HID: hid-goodix: Add Goodix HID-over-SPI driver
Date: Wed, 12 Jun 2024 18:43:58 +0800 [thread overview]
Message-ID: <Zml77pa-rUJtZebV@ux-UP-WHL01> (raw)
In-Reply-To: <030b639e-f5d1-40a2-8980-f436ca686e6e@moroto.mountain>
Hi Dan,
Thank you. Dmitry has pointed this out.
Charles.
On Mon, Jun 10, 2024 at 12:39:54PM +0300, Dan Carpenter wrote:
> Hi Charles,
>
> kernel test robot noticed the following build warnings:
>
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Charles-Wang/HID-hid-goodix-Add-Goodix-HID-over-SPI-driver/20240607-214042
> base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
> patch link: https://lore.kernel.org/r/20240607133709.3518-1-charles.goodix%40gmail.com
> patch subject: [PATCH v3] HID: hid-goodix: Add Goodix HID-over-SPI driver
> config: sparc64-randconfig-r071-20240609 (https://download.01.org/0day-ci/archive/20240610/202406101633.1RJnij1Y-lkp@intel.com/config)
> compiler: sparc64-linux-gcc (GCC) 13.2.0
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202406101633.1RJnij1Y-lkp@intel.com/
>
> smatch warnings:
> drivers/hid/hid-goodix-spi.c:217 goodix_hid_parse() error: uninitialized symbol 'rdesc'.
>
> vim +/rdesc +217 drivers/hid/hid-goodix-spi.c
>
> bb11c3a1740813 Charles Wang 2024-06-07 214 static int goodix_hid_parse(struct hid_device *hid)
> bb11c3a1740813 Charles Wang 2024-06-07 215 {
> bb11c3a1740813 Charles Wang 2024-06-07 216 struct goodix_ts_data *ts = hid->driver_data;
> bb11c3a1740813 Charles Wang 2024-06-07 @217 u8 *rdesc __free(kfree);
> bb11c3a1740813 Charles Wang 2024-06-07 218 u16 rsize;
> bb11c3a1740813 Charles Wang 2024-06-07 219 int error;
> bb11c3a1740813 Charles Wang 2024-06-07 220
> bb11c3a1740813 Charles Wang 2024-06-07 221 rsize = le16_to_cpu(ts->hid_desc.report_desc_lenght);
> bb11c3a1740813 Charles Wang 2024-06-07 222 if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {
> bb11c3a1740813 Charles Wang 2024-06-07 223 dev_err(ts->dev, "invalid report desc size %d", rsize);
> bb11c3a1740813 Charles Wang 2024-06-07 224 return -EINVAL;
> ^^^^^^^^^^^^^^^
> rdesc isn't initialized here. It should be declared as:
>
> u8 *rdesc __free(kfree) = NULL;
>
> bb11c3a1740813 Charles Wang 2024-06-07 225 }
> bb11c3a1740813 Charles Wang 2024-06-07 226
> bb11c3a1740813 Charles Wang 2024-06-07 227 rdesc = kzalloc(rsize, GFP_KERNEL);
>
> Or it could be declared here instead.
>
> u8 *rdesc __free(kfree) = kzalloc(rsize, GFP_KERNEL);
>
> bb11c3a1740813 Charles Wang 2024-06-07 228 if (!rdesc)
> bb11c3a1740813 Charles Wang 2024-06-07 229 return -ENOMEM;
> bb11c3a1740813 Charles Wang 2024-06-07 230
> bb11c3a1740813 Charles Wang 2024-06-07 231 error = goodix_spi_read(ts, GOODIX_HID_REPORT_DESC_ADDR, rdesc, rsize);
> bb11c3a1740813 Charles Wang 2024-06-07 232 if (error) {
> bb11c3a1740813 Charles Wang 2024-06-07 233 dev_err(ts->dev, "failed get report desc, %d", error);
> bb11c3a1740813 Charles Wang 2024-06-07 234 return error;
> bb11c3a1740813 Charles Wang 2024-06-07 235 }
> bb11c3a1740813 Charles Wang 2024-06-07 236
> bb11c3a1740813 Charles Wang 2024-06-07 237 error = hid_parse_report(hid, rdesc, rsize);
> bb11c3a1740813 Charles Wang 2024-06-07 238 if (error)
> bb11c3a1740813 Charles Wang 2024-06-07 239 dev_err(ts->dev, "failed parse report, %d", error);
> bb11c3a1740813 Charles Wang 2024-06-07 240
> bb11c3a1740813 Charles Wang 2024-06-07 241 return error;
> bb11c3a1740813 Charles Wang 2024-06-07 242 }
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
next prev parent reply other threads:[~2024-06-12 10:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 13:36 [PATCH v3] HID: hid-goodix: Add Goodix HID-over-SPI driver Charles Wang
2024-06-07 18:59 ` Dmitry Torokhov
2024-06-12 10:30 ` Charles Wang
2024-06-10 9:39 ` Dan Carpenter
2024-06-12 10:43 ` Charles Wang [this message]
2024-06-13 10:56 ` Thomas Weißschuh
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=Zml77pa-rUJtZebV@ux-UP-WHL01 \
--to=charles.goodix@gmail.com \
--cc=bentiss@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=dianders@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=hbarnor@chromium.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
/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).