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] [day] [month] [year] [list]
Message-ID: <20210612023124.GF29138@dragon>
Date:   Sat, 12 Jun 2021 10:31:25 +0800
From:   Shawn Guo <shawnguo@...nel.org>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-imx@....com
Subject: Re: [PATCH -next 1/2] ARM: imx: add missing iounmap() in
 imx_mmdc_remove()

On Mon, May 24, 2021 at 03:06:59PM +0800, Yang Yingliang wrote:
> mmdc_base need be unmapped in imx_mmdc_remove().
> 
> Fixes: e76bdfd7403a ("ARM: imx: Added perf functionality to mmdc driver")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
>  arch/arm/mach-imx/mmdc.c | 28 ++++++++++++++++------------
>  1 file changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c
> index 0dfd0ae7a63d..c313eb1f614c 100644
> --- a/arch/arm/mach-imx/mmdc.c
> +++ b/arch/arm/mach-imx/mmdc.c
> @@ -77,6 +77,8 @@ static const struct of_device_id imx_mmdc_dt_ids[] = {
>  	{ /* sentinel */ }
>  };
>  
> +static void __iomem *mmdc_base;
> +

I do not like such variables.  Can we have a data structure holding this
and the clock that patch 2/2 is adding?  Also please consider to
consolidate the mmdc_base in' struct mmdc_pmu'.

Shawn

>  #ifdef CONFIG_PERF_EVENTS
>  
>  static enum cpuhp_state cpuhp_mmdc_state;
> @@ -456,16 +458,6 @@ static int mmdc_pmu_init(struct mmdc_pmu *pmu_mmdc,
>  	return mmdc_num;
>  }
>  
> -static int imx_mmdc_remove(struct platform_device *pdev)
> -{
> -	struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev);
> -
> -	cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
> -	perf_pmu_unregister(&pmu_mmdc->pmu);
> -	kfree(pmu_mmdc);
> -	return 0;
> -}
> -
>  static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base)
>  {
>  	struct mmdc_pmu *pmu_mmdc;
> @@ -528,14 +520,26 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
>  }
>  
>  #else
> -#define imx_mmdc_remove NULL
>  #define imx_mmdc_perf_init(pdev, mmdc_base) 0
>  #endif
>  
> +static int imx_mmdc_remove(struct platform_device *pdev)
> +{
> +#ifdef CONFIG_PERF_EVENTS
> +	struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev);
> +
> +	cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
> +	perf_pmu_unregister(&pmu_mmdc->pmu);
> +	kfree(pmu_mmdc);
> +#endif
> +	iounmap(mmdc_base);
> +	return 0;
> +}
> +
>  static int imx_mmdc_probe(struct platform_device *pdev)
>  {
>  	struct device_node *np = pdev->dev.of_node;
> -	void __iomem *mmdc_base, *reg;
> +	void *reg;
>  	struct clk *mmdc_ipg_clk;
>  	u32 val;
>  	int err;
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ