diff mbox series

[v1] scsi: Convert to use ERR_CAST()

Message ID 20240829091726.33984-1-shenlichuan@vivo.com
State New
Headers show
Series [v1] scsi: Convert to use ERR_CAST() | expand

Commit Message

Shen Lichuan Aug. 29, 2024, 9:17 a.m. UTC
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: Shen Lichuan <shenlichuan@vivo.com>
---
 drivers/scsi/cxgbi/libcxgbi.c | 2 +-
 drivers/scsi/scsi_devinfo.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index bf75940f2be1..b2456989bcba 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -2890,7 +2890,7 @@  struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *shost,
 	}
 
 	if (IS_ERR(csk))
-		return (struct iscsi_endpoint *)csk;
+		return ERR_CAST(csk);
 	cxgbi_sock_get(csk);
 
 	if (!hba)
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 90f1393a23f8..6a04cd1a86d6 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -423,7 +423,7 @@  static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
 	const char *vskip, *mskip;
 
 	if (IS_ERR(devinfo_table))
-		return (struct scsi_dev_info_list *) devinfo_table;
+		return ERR_CAST(devinfo_table);
 
 	/* Prepare for "compatible" matches */