Date: Wed, 24 Nov 2021 04:22:20 GMT From: Warner Losh <imp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 6637b7460066 - main - cam: Remove all the write-only variables Message-ID: <202111240422.1AO4MKm5049741@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6637b7460066314f9b3ce0073ec6563e15ece608 commit 6637b7460066314f9b3ce0073ec6563e15ece608 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2021-11-24 04:14:05 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2021-11-24 04:21:18 +0000 cam: Remove all the write-only variables Delete all the write only variables in CAM. At worst, the only behavior change would be to prevent core dumps from chasing NULL pointers (though I think in all these cases the pointers can't be NULL). Sponsored by: Netflix --- sys/cam/nvme/nvme_da.c | 7 ------- sys/cam/nvme/nvme_xpt.c | 4 ---- sys/cam/scsi/scsi_cd.c | 2 -- sys/cam/scsi/scsi_ch.c | 5 ----- sys/cam/scsi/scsi_da.c | 6 ------ sys/cam/scsi/scsi_enc.c | 5 ----- sys/cam/scsi/scsi_enc_ses.c | 4 ---- sys/cam/scsi/scsi_pass.c | 10 +--------- 8 files changed, 1 insertion(+), 42 deletions(-) diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c index baeaad182f3a..f1c9a9ec9fea 100644 --- a/sys/cam/nvme/nvme_da.c +++ b/sys/cam/nvme/nvme_da.c @@ -375,10 +375,8 @@ ndaioctl(struct disk *dp, u_long cmd, void *data, int fflag, struct thread *td) { struct cam_periph *periph; - struct nda_softc *softc; periph = (struct cam_periph *)dp->d_drv1; - softc = (struct nda_softc *)periph->softc; switch (cmd) { case NVME_IO_TEST: @@ -1269,11 +1267,6 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb) static int ndaerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags) { - struct nda_softc *softc; - struct cam_periph *periph; - - periph = xpt_path_periph(ccb->ccb_h.path); - softc = (struct nda_softc *)periph->softc; switch (ccb->ccb_h.status & CAM_STATUS_MASK) { case CAM_CMD_TIMEOUT: diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c index 22d984d02038..4e68330e63e7 100644 --- a/sys/cam/nvme/nvme_xpt.c +++ b/sys/cam/nvme/nvme_xpt.c @@ -258,13 +258,11 @@ nvme_probe_start(struct cam_periph *periph, union ccb *start_ccb) { struct ccb_nvmeio *nvmeio; nvme_probe_softc *softc; - struct cam_path *path; lun_id_t lun; CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("nvme_probe_start\n")); softc = (nvme_probe_softc *)periph->softc; - path = start_ccb->ccb_h.path; nvmeio = &start_ccb->nvmeio; lun = xpt_path_lun_id(periph->path); @@ -312,7 +310,6 @@ nvme_probe_done(struct cam_periph *periph, union ccb *done_ccb) struct cam_path *path; struct scsi_vpd_device_id *did; struct scsi_vpd_id_descriptor *idd; - cam_status status; u_int32_t priority; int found = 1, e, g, len; @@ -335,7 +332,6 @@ out: /* Don't wedge the queue */ xpt_release_devq(path, /*count*/1, /*run_queue*/TRUE); } - status = done_ccb->ccb_h.status & CAM_STATUS_MASK; /* * If we get to this point, we got an error status back diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 3cca4bbf243b..3f5cadb44fdc 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -3146,12 +3146,10 @@ static int cdreadtoc(struct cam_periph *periph, u_int32_t mode, u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags) { - u_int32_t ntoc; struct ccb_scsiio *csio; union ccb *ccb; int error; - ntoc = len; error = 0; ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index d440526a7913..bccca0e87726 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -734,11 +734,6 @@ chdone(struct cam_periph *periph, union ccb *done_ccb) static int cherror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags) { - struct ch_softc *softc; - struct cam_periph *periph; - - periph = xpt_path_periph(ccb->ccb_h.path); - softc = (struct ch_softc *)periph->softc; return (cam_periph_error(ccb, cam_flags, sense_flags)); } diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 31aeb59d9438..83e14eca35ab 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -4533,13 +4533,11 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) struct bio *bp, *bp1; struct da_softc *softc; struct ccb_scsiio *csio; - u_int32_t priority; da_ccb_state state; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone\n")); softc = (struct da_softc *)periph->softc; - priority = done_ccb->ccb_h.pinfo.priority; csio = &done_ccb->csio; #if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) @@ -5304,7 +5302,6 @@ dadone_probeata(struct cam_periph *periph, union ccb *done_ccb) u_int32_t priority; int continue_probe; int error; - int16_t *ptr; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone_probeata\n")); @@ -5312,7 +5309,6 @@ dadone_probeata(struct cam_periph *periph, union ccb *done_ccb) priority = done_ccb->ccb_h.pinfo.priority; csio = &done_ccb->csio; ata_params = (struct ata_params *)csio->data_ptr; - ptr = (uint16_t *)ata_params; continue_probe = 0; error = 0; @@ -5897,12 +5893,10 @@ static void dadone_tur(struct cam_periph *periph, union ccb *done_ccb) { struct da_softc *softc; - struct ccb_scsiio *csio; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone_tur\n")); softc = (struct da_softc *)periph->softc; - csio = &done_ccb->csio; cam_periph_assert(periph, MA_OWNED); diff --git a/sys/cam/scsi/scsi_enc.c b/sys/cam/scsi/scsi_enc.c index 30cbf108fd44..ad6c09c99f58 100644 --- a/sys/cam/scsi/scsi_enc.c +++ b/sys/cam/scsi/scsi_enc.c @@ -345,11 +345,6 @@ enc_close(struct cdev *dev, int flag, int fmt, struct thread *td) int enc_error(union ccb *ccb, uint32_t cflags, uint32_t sflags) { - struct enc_softc *softc; - struct cam_periph *periph; - - periph = xpt_path_periph(ccb->ccb_h.path); - softc = (struct enc_softc *)periph->softc; return (cam_periph_error(ccb, cflags, sflags)); } diff --git a/sys/cam/scsi/scsi_enc_ses.c b/sys/cam/scsi/scsi_enc_ses.c index 39d99fd23eb9..803630f31f54 100644 --- a/sys/cam/scsi/scsi_enc_ses.c +++ b/sys/cam/scsi/scsi_enc_ses.c @@ -1339,7 +1339,6 @@ ses_process_config(enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len) { struct ses_iterator iter; - ses_softc_t *ses; enc_cache_t *enc_cache; ses_cache_t *ses_cache; uint8_t *buf; @@ -1362,7 +1361,6 @@ ses_process_config(enc_softc_t *enc, struct enc_fsm_state *state, CAM_DEBUG(enc->periph->path, CAM_DEBUG_SUBTRACE, ("entering %s(%p, %d)\n", __func__, bufp, xfer_len)); - ses = enc->enc_private; enc_cache = &enc->enc_daemon_cache; ses_cache = enc_cache->private; buf = *bufp; @@ -2870,7 +2868,6 @@ ses_get_elm_devnames(enc_softc_t *enc, encioc_elm_devnames_t *elmdn) static int ses_handle_string(enc_softc_t *enc, encioc_string_t *sstr, int ioc) { - ses_softc_t *ses; enc_cache_t *enc_cache; ses_cache_t *ses_cache; const struct ses_enc_desc *enc_desc; @@ -2883,7 +2880,6 @@ ses_handle_string(enc_softc_t *enc, encioc_string_t *sstr, int ioc) uint8_t *buf; size_t size, rsize; - ses = enc->enc_private; enc_cache = &enc->enc_daemon_cache; ses_cache = enc_cache->private; diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index e7d9d755c8cc..5d6febe74539 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -1202,7 +1202,7 @@ static int passcopysglist(struct cam_periph *periph, struct pass_io_req *io_req, ccb_flags direction) { - bus_size_t kern_watermark, user_watermark, len_copied, len_to_copy; + bus_size_t kern_watermark, user_watermark, len_to_copy; bus_dma_segment_t *user_sglist, *kern_sglist; int i, j, error; @@ -1210,7 +1210,6 @@ passcopysglist(struct cam_periph *periph, struct pass_io_req *io_req, kern_watermark = 0; user_watermark = 0; len_to_copy = 0; - len_copied = 0; user_sglist = io_req->user_segptr; kern_sglist = io_req->kern_segptr; @@ -1249,8 +1248,6 @@ passcopysglist(struct cam_periph *periph, struct pass_io_req *io_req, } } - len_copied += len_to_copy; - if (user_sglist[i].ds_len == user_watermark) { i++; user_watermark = 0; @@ -2239,11 +2236,6 @@ passsendccb(struct cam_periph *periph, union ccb *ccb, union ccb *inccb) static int passerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags) { - struct cam_periph *periph; - struct pass_softc *softc; - - periph = xpt_path_periph(ccb->ccb_h.path); - softc = (struct pass_softc *)periph->softc; return(cam_periph_error(ccb, cam_flags, sense_flags)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111240422.1AO4MKm5049741>