* [PATCH] soc: imx: scu: use devm_kasprintf
@ 2020-06-03 9:29 peng.fan
2020-06-03 11:15 ` Daniel Baluta
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: peng.fan @ 2020-06-03 9:29 UTC (permalink / raw)
To: shawnguo, s.hauer, aisheng.dong
Cc: kernel, festevam, leonard.crestez, linux-kernel,
linux-arm-kernel, linux-imx, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_kasprintf to simplify code
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/soc/imx/soc-imx-scu.c | 37 +++++++++++--------------------------
1 file changed, 11 insertions(+), 26 deletions(-)
diff --git a/drivers/soc/imx/soc-imx-scu.c b/drivers/soc/imx/soc-imx-scu.c
index 20d37eaeb5f2..92448ca9a6f8 100644
--- a/drivers/soc/imx/soc-imx-scu.c
+++ b/drivers/soc/imx/soc-imx-scu.c
@@ -115,43 +115,28 @@ static int imx_scu_soc_probe(struct platform_device *pdev)
/* format soc_id value passed from SCU firmware */
val = id & 0x1f;
- soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "0x%x", val);
+ soc_dev_attr->soc_id = devm_kasprintf(&pdev->dev, GFP_KERNEL, "0x%x", val);
if (!soc_dev_attr->soc_id)
return -ENOMEM;
/* format revision value passed from SCU firmware */
val = (id >> 5) & 0xf;
val = (((val >> 2) + 1) << 4) | (val & 0x3);
- soc_dev_attr->revision = kasprintf(GFP_KERNEL,
- "%d.%d",
- (val >> 4) & 0xf,
- val & 0xf);
- if (!soc_dev_attr->revision) {
- ret = -ENOMEM;
- goto free_soc_id;
- }
+ soc_dev_attr->revision = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%d.%d",
+ (val >> 4) & 0xf, val & 0xf);
+ if (!soc_dev_attr->revision)
+ return -ENOMEM;
- soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", uid);
- if (!soc_dev_attr->serial_number) {
- ret = -ENOMEM;
- goto free_revision;
- }
+ soc_dev_attr->serial_number = devm_kasprintf(&pdev->dev, GFP_KERNEL,
+ "%016llX", uid);
+ if (!soc_dev_attr->serial_number)
+ return -ENOMEM;
soc_dev = soc_device_register(soc_dev_attr);
- if (IS_ERR(soc_dev)) {
- ret = PTR_ERR(soc_dev);
- goto free_serial_number;
- }
+ if (IS_ERR(soc_dev))
+ return PTR_ERR(soc_dev);
return 0;
-
-free_serial_number:
- kfree(soc_dev_attr->serial_number);
-free_revision:
- kfree(soc_dev_attr->revision);
-free_soc_id:
- kfree(soc_dev_attr->soc_id);
- return ret;
}
static struct platform_driver imx_scu_soc_driver = {
--
2.16.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] soc: imx: scu: use devm_kasprintf
2020-06-03 9:29 [PATCH] soc: imx: scu: use devm_kasprintf peng.fan
@ 2020-06-03 11:15 ` Daniel Baluta
2020-06-04 8:48 ` Aisheng Dong
2020-06-23 7:13 ` Shawn Guo
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Baluta @ 2020-06-03 11:15 UTC (permalink / raw)
To: peng.fan, shawnguo, s.hauer, aisheng.dong
Cc: kernel, festevam, leonard.crestez, linux-kernel,
linux-arm-kernel, linux-imx
On 03.06.2020 12:29, peng.fan@nxp.com wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Use devm_kasprintf to simplify code
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] soc: imx: scu: use devm_kasprintf
2020-06-03 9:29 [PATCH] soc: imx: scu: use devm_kasprintf peng.fan
2020-06-03 11:15 ` Daniel Baluta
@ 2020-06-04 8:48 ` Aisheng Dong
2020-06-23 7:13 ` Shawn Guo
2 siblings, 0 replies; 4+ messages in thread
From: Aisheng Dong @ 2020-06-04 8:48 UTC (permalink / raw)
To: Peng Fan, shawnguo, s.hauer
Cc: kernel, festevam, Leonard Crestez, linux-kernel,
linux-arm-kernel, dl-linux-imx
> From: Peng Fan <peng.fan@nxp.com>
> Sent: Wednesday, June 3, 2020 5:30 PM
>
> Use devm_kasprintf to simplify code
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Regards
Aisheng
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] soc: imx: scu: use devm_kasprintf
2020-06-03 9:29 [PATCH] soc: imx: scu: use devm_kasprintf peng.fan
2020-06-03 11:15 ` Daniel Baluta
2020-06-04 8:48 ` Aisheng Dong
@ 2020-06-23 7:13 ` Shawn Guo
2 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2020-06-23 7:13 UTC (permalink / raw)
To: peng.fan
Cc: s.hauer, aisheng.dong, kernel, festevam, leonard.crestez,
linux-kernel, linux-arm-kernel, linux-imx
On Wed, Jun 03, 2020 at 05:29:32PM +0800, peng.fan@nxp.com wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Use devm_kasprintf to simplify code
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-06-23 7:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 9:29 [PATCH] soc: imx: scu: use devm_kasprintf peng.fan
2020-06-03 11:15 ` Daniel Baluta
2020-06-04 8:48 ` Aisheng Dong
2020-06-23 7:13 ` Shawn Guo
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).