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: <03de06b4-9814-81bf-f0c0-6bdb179b6c70@arm.com>
Date:   Mon, 29 Apr 2019 09:16:41 +0100
From:   Marc Zyngier <marc.zyngier@....com>
To:     Mukesh Ojha <mojha@...eaurora.org>, tglx@...utronix.de,
        jason@...edaemon.net, yamada.masahiro@...ionext.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/7] irqchip/irq-mbigen.c: Use
 devm_platform_ioremap_resource()

On 04/04/2019 08:20, Mukesh Ojha wrote:
> devm_platform_ioremap_resource() internally have platform_get_resource()
> and devm_ioremap_resource() in it. So instead of calling them separately
> use devm_platform_ioremap_resource() directly.
> 
> Signed-off-by: Mukesh Ojha <mojha@...eaurora.org>
> ---
>  drivers/irqchip/irq-ls-scfg-msi.c | 4 +---
>  drivers/irqchip/irq-mbigen.c      | 9 +--------
>  2 files changed, 2 insertions(+), 11 deletions(-)

You're changing two drivers, and yet only mention one. Bad.

> 
> diff --git a/drivers/irqchip/irq-ls-scfg-msi.c b/drivers/irqchip/irq-ls-scfg-msi.c
> index c671b32..aec5a2f 100644
> --- a/drivers/irqchip/irq-ls-scfg-msi.c
> +++ b/drivers/irqchip/irq-ls-scfg-msi.c
> @@ -336,7 +336,6 @@ static int ls_scfg_msi_probe(struct platform_device *pdev)
>  {
>  	const struct of_device_id *match;
>  	struct ls_scfg_msi *msi_data;
> -	struct resource *res;
>  	int i, ret;
>  
>  	match = of_match_device(ls_scfg_msi_id, &pdev->dev);
> @@ -349,8 +348,7 @@ static int ls_scfg_msi_probe(struct platform_device *pdev)
>  
>  	msi_data->cfg = (struct ls_scfg_msi_cfg *) match->data;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	msi_data->regs = devm_ioremap_resource(&pdev->dev, res);
> +	msi_data->regs = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(msi_data->regs)) {
>  		dev_err(&pdev->dev, "failed to initialize 'regs'\n");
>  		return PTR_ERR(msi_data->regs);
> diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
> index 98b6e1d..c9aedfb 100644
> --- a/drivers/irqchip/irq-mbigen.c
> +++ b/drivers/irqchip/irq-mbigen.c
> @@ -327,7 +327,6 @@ static inline int mbigen_acpi_create_domain(struct platform_device *pdev,
>  static int mbigen_device_probe(struct platform_device *pdev)
>  {
>  	struct mbigen_device *mgn_chip;
> -	struct resource *res;
>  	int err;
>  
>  	mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL);
> @@ -335,13 +334,7 @@ static int mbigen_device_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	mgn_chip->pdev = pdev;
> -
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res)
> -		return -EINVAL;
> -
> -	mgn_chip->base = devm_ioremap(&pdev->dev, res->start,
> -				      resource_size(res));
> +	mgn_chip->base = devm_platform_ioremap_resource(pdev, 0);
>  	if (!mgn_chip->base) {

Now you are introducing a bug, as devm_ioremap and
devm_platform_ioremap_resource do not return the same thing.

>  		dev_err(&pdev->dev, "failed to ioremap %pR\n", res);
>  		return -ENOMEM;
> 

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ