]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm: Convert to use ERR_CAST()
authorYuesong Li <liyuesong@vivo.com>
Fri, 30 Aug 2024 03:16:42 +0000 (11:16 +0800)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 2 Sep 2024 09:41:11 +0000 (11:41 +0200)
Use ERR_CAST() as it is designed for casting an error pointer to
another type.

This macro utilizes the __force and __must_check modifiers, which instruct
the compiler to verify for errors at the locations where it is employed.

Signed-off-by: Yuesong Li <liyuesong@vivo.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-thin.c

index a0c1620e90c8ce4e02103f3dd085fbc70332f9a1..89632ce9776056aee6ab7d6f207ba24f7f6ddff6 100644 (file)
@@ -2948,7 +2948,7 @@ static struct pool *pool_create(struct mapped_device *pool_md,
        pmd = dm_pool_metadata_open(metadata_dev, block_size, format_device);
        if (IS_ERR(pmd)) {
                *error = "Error creating metadata object";
-               return (struct pool *)pmd;
+               return ERR_CAST(pmd);
        }
 
        pool = kzalloc(sizeof(*pool), GFP_KERNEL);