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>] [day] [month] [year] [list]
Date: Thu, 28 Dec 2023 17:28:48 +0000
From: jyri.sarha@....fi
To: "Philipp Stanner" <pstanner@...hat.com>, "Jyri Sarha"
 <jyri.sarha@....fi>, "Tomi Valkeinen" <tomi.valkeinen@...asonboard.com>,
 "Maarten Lankhorst" <maarten.lankhorst@...ux.intel.com>, "Maxime Ripard"
 <mripard@...nel.org>, "Thomas Zimmermann" <tzimmermann@...e.de>, "David
 Airlie" <airlied@...il.com>, "Daniel Vetter" <daniel@...ll.ch>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/tilcdc: request and mapp iomem with devres

December 22, 2023 at 1:52 PM, "Philipp Stanner" <pstanner@...hat.com mailto:pstanner@...hat.com?to=%22Philipp%20Stanner%22%20%3Cpstanner%40redhat.com%3E > wrote:

> 
> tilcdc currently just ioremaps its iomem, without doing the (a bit more
> robust) request on the memory first. The devm_ functions provide a handy
> way to both request and ioremap the memory with automatic cleanup.
> 
> Replace the manual ioremap with the devm_ version.
> 
> Suggested-by: Thomas Zimmermann <tzimmermann@...e.de>
> Signed-off-by: Philipp Stanner <pstanner@...hat.com>

Reviewed-by: Jyri Sarha <jyri.sarha@....fi>
Tested-by: Jyri Sarha <jyri.sarha@....fi>

I'll apply this shortly to drm-misc-next.

Thanks,
Jyri

> ---
> drivers/gpu/drm/tilcdc/tilcdc_drv.c | 19 ++++---------------
> 1 file changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 8ebd7134ee21..2ad3f44a6e2d 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -182,9 +182,6 @@ static void tilcdc_fini(struct drm_device *dev)
>  if (priv->clk)
>  clk_put(priv->clk);
> 
> - if (priv->mmio)
> - iounmap(priv->mmio);
> -
>  if (priv->wq)
>  destroy_workqueue(priv->wq);
> 
> @@ -201,7 +198,6 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
>  struct platform_device *pdev = to_platform_device(dev);
>  struct device_node *node = dev->of_node;
>  struct tilcdc_drm_private *priv;
> - struct resource *res;
>  u32 bpp = 0;
>  int ret;
> 
> @@ -226,17 +222,10 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
>  goto init_failed;
>  }
> 
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res) {
> - dev_err(dev, "failed to get memory resource\n");
> - ret = -EINVAL;
> - goto init_failed;
> - }
> -
> - priv->mmio = ioremap(res->start, resource_size(res));
> - if (!priv->mmio) {
> - dev_err(dev, "failed to ioremap\n");
> - ret = -ENOMEM;
> + priv->mmio = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(priv->mmio)) {
> + dev_err(dev, "failed to request / ioremap\n");
> + ret = PTR_ERR(priv->mmio);
>  goto init_failed;
>  }
> 
> -- 
> 2.43.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ