aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/smartpqi
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-06-28 22:01:30 +0000
committerWarner Losh <imp@FreeBSD.org>2021-06-28 22:13:03 +0000
commit30f8afd0270e0bb70e1e0df1cf8de7a841797a30 (patch)
tree9c4bbe98fc3a47eff83b3c176b7f152854a6e554 /sys/dev/smartpqi
parentdcd5dea96509f6e483861350c9ef1d6a85b44ff6 (diff)
downloadsrc-30f8afd0270e0bb70e1e0df1cf8de7a841797a30.tar.gz
src-30f8afd0270e0bb70e1e0df1cf8de7a841797a30.zip
cam: fix xpt_bus_register and xpt_bus_deregister return errno
xpt_bus_register and xpt_bus_deregister returns a hybrid error that's neither a cam_status, nor an errno, but a mix of both. Update xpt_bus_register and xpt_bus_deregister to return an errno. The vast majority of current users compare against zero, which can also be spelled CAM_SUCCESS. Nobody uses CAM_FAILURE, so remove that symbol to prevent comfusion (nothing returns it either). Where the return value is saved, ensure that the variable 'error' is used to store an errno and 'status' is used to store a cam_status where it makes the code clearer (usually just in functions that already mix and match). Where the return value isn't used at all, avoid storing it at all. Reviewed by: scottl@, mav@ (earlier version) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30860
Diffstat (limited to 'sys/dev/smartpqi')
-rw-r--r--sys/dev/smartpqi/smartpqi_cam.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/smartpqi/smartpqi_cam.c b/sys/dev/smartpqi/smartpqi_cam.c
index e389eb143e4a..1278434131d9 100644
--- a/sys/dev/smartpqi/smartpqi_cam.c
+++ b/sys/dev/smartpqi/smartpqi_cam.c
@@ -1204,7 +1204,7 @@ register_sim(struct pqisrc_softstate *softs, int card_index)
{
int max_transactions;
union ccb *ccb = NULL;
- cam_status status = 0;
+ int error;
struct ccb_setasync csa;
struct cam_sim *sim;
@@ -1231,9 +1231,9 @@ register_sim(struct pqisrc_softstate *softs, int card_index)
softs->os_specific.sim = sim;
mtx_lock(&softs->os_specific.cam_lock);
- status = xpt_bus_register(sim, softs->os_specific.pqi_dev, 0);
- if (status != CAM_SUCCESS) {
- DBG_ERR("xpt_bus_register failed status=%d\n", status);
+ error = xpt_bus_register(sim, softs->os_specific.pqi_dev, 0);
+ if (error != CAM_SUCCESS) {
+ DBG_ERR("xpt_bus_register failed errno %d\n", error);
cam_sim_free(softs->os_specific.sim, FALSE);
cam_simq_free(softs->os_specific.devq);
mtx_unlock(&softs->os_specific.cam_lock);