[PATCH v1] scsi: Convert to use ERR_CAST()
From: Shen Lichuan
Date: Thu Aug 29 2024 - 05:17:55 EST
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@xxxxxxxx>
---
drivers/scsi/cxgbi/libcxgbi.c | 2 +-
drivers/scsi/scsi_devinfo.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
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 */
--
2.17.1