Linux CXL
 help / color / mirror / Atom feed
* [PATCH v1] cxl/port: Convert to use ERR_CAST()
@ 2024-08-29 12:52 Yuesong Li
  2024-08-29 14:43 ` Jonathan Cameron
  2024-08-29 21:45 ` Alison Schofield
  0 siblings, 2 replies; 3+ messages in thread
From: Yuesong Li @ 2024-08-29 12:52 UTC (permalink / raw)
  To: dave, jonathan.cameron, dave.jiang, alison.schofield,
	vishal.l.verma, ira.weiny, dan.j.williams, rrichter, terry.bowman,
	Benjamin.Cheatham
  Cc: linux-cxl, linux-kernel, opensource.kernel, Yuesong Li

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>
---
 drivers/cxl/core/port.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index 1d5007e3795a..bdd3275ad417 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-29 21:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29 12:52 [PATCH v1] cxl/port: Convert to use ERR_CAST() Yuesong Li
2024-08-29 14:43 ` Jonathan Cameron
2024-08-29 21:45 ` Alison Schofield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox