From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Vadim Pasternak <vadimp@nvidia.com>
Cc: Kunwu Chan <chentao@kylinos.cn>,
"hdegoede@redhat.com" <hdegoede@redhat.com>,
"jdelvare@suse.com" <jdelvare@suse.com>,
"linux@roeck-us.net" <linux@roeck-us.net>,
Shravan Ramani <shravankr@nvidia.com>,
"jiri@resnulli.us" <jiri@resnulli.us>,
"kunwu.chan@hotmail.com" <kunwu.chan@hotmail.com>,
"platform-driver-x86@vger.kernel.org"
<platform-driver-x86@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>
Subject: RE: [PATCH v2] platform/mellanox: Add some null/error pointer checks to mlxbf-pmc.c
Date: Mon, 4 Dec 2023 15:07:06 +0200 (EET) [thread overview]
Message-ID: <b2fa490-4e48-44a6-64d3-45ef4f5c14b@linux.intel.com> (raw)
In-Reply-To: <BN9PR12MB5381B3408452445483B7281EAF81A@BN9PR12MB5381.namprd12.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
> > Subject: [PATCH v2] platform/mellanox: Add some null/error pointer checks to
> > mlxbf-pmc.c
> >
> > devm_kasprintf() returns a pointer to dynamically allocated memory which
> > can be NULL upon failure.
> > devm_hwmon_device_register_with_groups return a error pointer upon
> > failure.
> >
> > Compile-tested only.
> >
> > Fixes: 1a218d312e65 ("platform/mellanox: mlxbf-pmc: Add Mellanox
> > BlueField PMC driver")
> > Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > Suggested-by: Vadim Pasternak <vadimp@nvidia.com>
> > Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
>
> Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
> > attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL,
> > "enable");
> > + if (!attr->dev_attr.attr.name)
> > + return -ENOMEM;
> > pmc->hwmon_dev = devm_hwmon_device_register_with_groups(
> > dev, "bfperf", pmc, pmc->groups);
> > + if (IS_ERR(pmc->hwmon_dev))
> > + return PTR_ERR(pmc->hwmon_dev);
Thank you both, applied to review-ilpo and will go into fixes branch once
LKP has had its chance to build this.
In the end, I decided to split the devm_kasprintf() and
devm_hwmon_device_register_with_groups() changes into separate commits.
--
i.
prev parent reply other threads:[~2023-12-04 13:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 5:54 [PATCH v2] platform/mellanox: Add some null/error pointer checks to mlxbf-pmc.c Kunwu Chan
2023-12-01 20:35 ` Vadim Pasternak
2023-12-04 13:07 ` Ilpo Järvinen [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=b2fa490-4e48-44a6-64d3-45ef4f5c14b@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=chentao@kylinos.cn \
--cc=hdegoede@redhat.com \
--cc=jdelvare@suse.com \
--cc=jiri@resnulli.us \
--cc=kunwu.chan@hotmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=platform-driver-x86@vger.kernel.org \
--cc=shravankr@nvidia.com \
--cc=vadimp@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox