[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b2fa490-4e48-44a6-64d3-45ef4f5c14b@linux.intel.com>
Date: Mon, 4 Dec 2023 15:07:06 +0200 (EET)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Vadim Pasternak <vadimp@...dia.com>
cc: Kunwu Chan <chentao@...inos.cn>,
"hdegoede@...hat.com" <hdegoede@...hat.com>,
"jdelvare@...e.com" <jdelvare@...e.com>,
"linux@...ck-us.net" <linux@...ck-us.net>,
Shravan Ramani <shravankr@...dia.com>,
"jiri@...nulli.us" <jiri@...nulli.us>,
"kunwu.chan@...mail.com" <kunwu.chan@...mail.com>,
"platform-driver-x86@...r.kernel.org"
<platform-driver-x86@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hwmon@...r.kernel.org" <linux-hwmon@...r.kernel.org>
Subject: RE: [PATCH v2] platform/mellanox: Add some null/error pointer checks
to mlxbf-pmc.c
> > 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@...ux.intel.com>
> > Suggested-by: Vadim Pasternak <vadimp@...dia.com>
> > Signed-off-by: Kunwu Chan <chentao@...inos.cn>
>
> Reviewed-by: Vadim Pasternak <vadimp@...dia.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.
Powered by blists - more mailing lists