From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Basavaraj Natikar <bnatikar@amd.com>
Cc: Jiasheng Jiang <jiasheng@iscas.ac.cn>,
basavaraj.natikar@amd.com, jikos@kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: amd_sfh: Add missing check for dma_alloc_coherent
Date: Tue, 20 Dec 2022 11:47:11 +0100 [thread overview]
Message-ID: <CAO-hwJ++Dr94062SPnbqRJ33yJ5qB48--rnGyNQ12d6VvsCRUA@mail.gmail.com> (raw)
In-Reply-To: <035598f0-3174-9677-0b53-f3ccbfb54155@amd.com>
On Tue, Dec 20, 2022 at 7:53 AM Basavaraj Natikar <bnatikar@amd.com> wrote:
>
>
> On 12/20/2022 8:19 AM, Jiasheng Jiang wrote:
> > Add check for the return value of the dma_alloc_coherent since
> > it may return NULL pointer if allocation fails.
> >
> > Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)")
> > Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> > ---
> > drivers/hid/amd-sfh-hid/amd_sfh_client.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
> > index 8275bba63611..ab125f79408f 100644
> > --- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c
> > +++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
> > @@ -237,6 +237,10 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
> > in_data->sensor_virt_addr[i] = dma_alloc_coherent(dev, sizeof(int) * 8,
> > &cl_data->sensor_dma_addr[i],
> > GFP_KERNEL);
> > + if (!in_data->sensor_virt_addr[i]) {
> > + rc = -ENOMEM;
> > + goto cleanup;
> > + }
> > cl_data->sensor_sts[i] = SENSOR_DISABLED;
> > cl_data->sensor_requested_cnt[i] = 0;
> > cl_data->cur_hid_dev = i;
>
> looks good to me.
>
> Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Thanks.
I have now applied this patch to hid.git branch for-6.2/upstream-fixes.
Cheers,
Benjamin
prev parent reply other threads:[~2022-12-20 10:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 2:49 [PATCH] HID: amd_sfh: Add missing check for dma_alloc_coherent Jiasheng Jiang
2022-12-20 6:52 ` Basavaraj Natikar
2022-12-20 10:47 ` Benjamin Tissoires [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=CAO-hwJ++Dr94062SPnbqRJ33yJ5qB48--rnGyNQ12d6VvsCRUA@mail.gmail.com \
--to=benjamin.tissoires@redhat.com \
--cc=basavaraj.natikar@amd.com \
--cc=bnatikar@amd.com \
--cc=jiasheng@iscas.ac.cn \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).