From nobody Wed Nov 24 04:22:20 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 27D421889E2A; Wed, 24 Nov 2021 04:22:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HzSXF6K8qz3HtL; Wed, 24 Nov 2021 04:22:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7183239A8; Wed, 24 Nov 2021 04:22:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AO4MKNM049742; Wed, 24 Nov 2021 04:22:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AO4MKm5049741; Wed, 24 Nov 2021 04:22:20 GMT (envelope-from git) Date: Wed, 24 Nov 2021 04:22:20 GMT Message-Id: <202111240422.1AO4MKm5049741@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 6637b7460066 - main - cam: Remove all the write-only variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6637b7460066314f9b3ce0073ec6563e15ece608 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637727742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vjpYBPnQatmO1Rx76L67H/ubu/6OhAIugZX2FteY2y0=; b=iDruF6GCzgsYlEV27CAHJ0jbhtDkNtVoYLZwK5/jdW40u3A/T6HzZTFCZWoIdp1t/koVVw C0Zcy0sJlPaQNtgEAOwYspf5BsUyGCkBywxll6urF07Gq9zOJPvhan8dnn81CkBEqpX2tW cASaEEaVIo9IVlsZvf7t5LIeDsnejGIxANZOLOL3JGQZs8G9/+WxOzokjcD8+MlHlDWCxq IgAKiP1JFGATROcyzEHyLb5iQsXCcSJICbbo7wWyuN2vFj81cQwdPqJ6D0OKoEov2EvlLD mlbw7NZzGdpm4poFXBx9qIFgjIvZerZtNsaGOTDDvP7DM+5AFVN9Ay8rFeVBag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637727742; a=rsa-sha256; cv=none; b=ZuWtup2VL5O7ydWAWn+VvujcBHSkNrA02yyOQl8O3HZac3wlbK8gaWTGiY/n3S+yCWBXKv Md9DavXKnPwK8j48NOTxlrtubZ2J//Mff9s0Mvh8Y/PD60QNqNpPCtf5QiUUeWBJ6UjGX3 bvqCv7pi4UX5ffaNbiJ2UWkghx5CV6JJULml/PIlkgpt/uqFtQZoozKHBeYRag/RB+jrdy Y8rClXdlqNjm/5fnBcS7nya4kZRTpWC9nKrtQm8Si+dT5bJ57smf92p9z37qnIes4G+VMO H0jdU4RuL4cXXeQBcBEzwGgZgBVaIrGaOLjiZAVd0+dHU5h2FWtn7/khD/66fQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6637b7460066314f9b3ce0073ec6563e15ece608 commit 6637b7460066314f9b3ce0073ec6563e15ece608 Author: Warner Losh AuthorDate: 2021-11-24 04:14:05 +0000 Commit: Warner Losh 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)); }