lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aUQgmApH5fTmOXkq@lizhi-Precision-Tower-5810>
Date: Thu, 18 Dec 2025 10:41:12 -0500
From: Frank Li <Frank.li@....com>
To: "Peng Fan (OSS)" <peng.fan@....nxp.com>
Cc: Shawn Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>, imx@...ts.linux.dev,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Peng Fan <peng.fan@....com>
Subject: Re: [PATCH 1/3] soc: imx: Use device-managed APIs for i.MX9

On Wed, Dec 17, 2025 at 08:42:07PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@....com>
>
> Use device-managed APi to simplify code.
>
> Signed-off-by: Peng Fan <peng.fan@....com>
> ---

Reviewed-by: Frank Li <Frank.Li@....com>

>  drivers/soc/imx/soc-imx9.c | 28 +++++++++-------------------
>  1 file changed, 9 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/soc/imx/soc-imx9.c b/drivers/soc/imx/soc-imx9.c
> index b46d22cf0212c3f40f61ec5be85ca11e5d3207ac..0b1c59c7ddb244549bfeedc47ae6e8d83c20b39b 100644
> --- a/drivers/soc/imx/soc-imx9.c
> +++ b/drivers/soc/imx/soc-imx9.c
> @@ -18,6 +18,7 @@
>
>  static int imx9_soc_probe(struct platform_device *pdev)
>  {
> +	struct device *dev = &pdev->dev;
>  	struct soc_device_attribute *attr;
>  	struct arm_smccc_res res;
>  	struct soc_device *sdev;
> @@ -25,17 +26,17 @@ static int imx9_soc_probe(struct platform_device *pdev)
>  	u64 uid127_64, uid63_0;
>  	int err;
>
> -	attr = kzalloc(sizeof(*attr), GFP_KERNEL);
> +	attr = devm_kzalloc(dev, sizeof(*attr), GFP_KERNEL);
>  	if (!attr)
>  		return -ENOMEM;
>
>  	err = of_property_read_string(of_root, "model", &attr->machine);
>  	if (err) {
>  		pr_err("%s: missing model property: %d\n", __func__, err);
> -		goto attr;
> +		return err;
>  	}
>
> -	attr->family = kasprintf(GFP_KERNEL, "Freescale i.MX");
> +	attr->family = devm_kasprintf(dev, GFP_KERNEL, "Freescale i.MX");
>
>  	/*
>  	 * Retrieve the soc id, rev & uid info:
> @@ -47,39 +48,28 @@ static int imx9_soc_probe(struct platform_device *pdev)
>  	arm_smccc_smc(IMX_SIP_GET_SOC_INFO, 0, 0, 0, 0, 0, 0, 0, &res);
>  	if (res.a0 != SMCCC_RET_SUCCESS) {
>  		pr_err("%s: SMC failed: 0x%lx\n", __func__, res.a0);
> -		err = -EINVAL;
> -		goto family;
> +		return -EINVAL;
>  	}
>
>  	soc_id = SOC_ID(res.a1);
>  	rev_major = SOC_REV_MAJOR(res.a1);
>  	rev_minor = SOC_REV_MINOR(res.a1);
>
> -	attr->soc_id = kasprintf(GFP_KERNEL, "i.MX%2x", soc_id);
> -	attr->revision = kasprintf(GFP_KERNEL, "%d.%d", rev_major, rev_minor);
> +	attr->soc_id = devm_kasprintf(dev, GFP_KERNEL, "i.MX%2x", soc_id);
> +	attr->revision = devm_kasprintf(dev, GFP_KERNEL, "%d.%d", rev_major, rev_minor);
>
>  	uid127_64 = res.a2;
>  	uid63_0 = res.a3;
> -	attr->serial_number = kasprintf(GFP_KERNEL, "%016llx%016llx", uid127_64, uid63_0);
> +	attr->serial_number = devm_kasprintf(dev, GFP_KERNEL, "%016llx%016llx", uid127_64, uid63_0);
>
>  	sdev = soc_device_register(attr);
>  	if (IS_ERR(sdev)) {
>  		err = PTR_ERR(sdev);
>  		pr_err("%s failed to register SoC as a device: %d\n", __func__, err);
> -		goto serial_number;
> +		return err;
>  	}
>
>  	return 0;
> -
> -serial_number:
> -	kfree(attr->serial_number);
> -	kfree(attr->revision);
> -	kfree(attr->soc_id);
> -family:
> -	kfree(attr->family);
> -attr:
> -	kfree(attr);
> -	return err;
>  }
>
>  static __maybe_unused const struct of_device_id imx9_soc_match[] = {
>
> --
> 2.37.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ