]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: talitos - use devm_platform_ioremap_resource()
authorRosen Penev <rosenp@gmail.com>
Thu, 7 May 2026 23:44:16 +0000 (16:44 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 15 May 2026 10:08:48 +0000 (18:08 +0800)
platform_get_resource and devm_ioremap effectively open codes this.

The return type of devm_platform_ioremap_resource() is also nice as it
has multiple errors that it can return.

Because it internally calls devm_request_mem_region(), reg values and
sizes cannot overlap. This was manually verified to be the case for all
talitos users.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/talitos.c

index 2d69ee608665889727f5116109c56bc0c28e2821..584508963241c8297d39558154041c1ab1fdf068 100644 (file)
@@ -3413,7 +3413,6 @@ static int talitos_probe(struct platform_device *ofdev)
        unsigned int num_channels;
        int i, err;
        int stride;
-       struct resource *res;
 
        if (of_property_read_u32(np, "fsl,num-channels", &num_channels))
                return -EINVAL;
@@ -3432,13 +3431,10 @@ static int talitos_probe(struct platform_device *ofdev)
 
        spin_lock_init(&priv->reg_lock);
 
-       res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
-       if (!res)
-               return -ENXIO;
-       priv->reg = devm_ioremap(dev, res->start, resource_size(res));
-       if (!priv->reg) {
+       priv->reg = devm_platform_ioremap_resource(ofdev, 0);
+       if (IS_ERR(priv->reg)) {
                dev_err(dev, "failed to of_iomap\n");
-               err = -ENOMEM;
+               err = PTR_ERR(priv->reg);
                goto err_out;
        }