]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cxl/port: Convert to use ERR_CAST()
authorYuesong Li <liyuesong@vivo.com>
Thu, 29 Aug 2024 12:52:35 +0000 (20:52 +0800)
committerDave Jiang <dave.jiang@intel.com>
Tue, 3 Sep 2024 21:21:37 +0000 (14:21 -0700)
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>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Link: https://patch.msgid.link/20240829125235.3266865-1-liyuesong@vivo.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/port.c

index 1d5007e3795a3c107cfebee079f550188a715781..bdd3275ad417e1cea188cc096ecac9cc45b77279 100644 (file)
@@ -941,7 +941,7 @@ struct cxl_root *devm_cxl_add_root(struct device *host,
 
        port = devm_cxl_add_port(host, host, CXL_RESOURCE_NONE, NULL);
        if (IS_ERR(port))
-               return (struct cxl_root *)port;
+               return ERR_CAST(port);
 
        cxl_root = to_cxl_root(port);
        cxl_root->ops = ops;