From nobody Mon Dec 06 15:56:31 2021 X-Original-To: dev-commits-src-branches@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 92A0B18C5B3D; Mon, 6 Dec 2021 15:56:40 +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 4J77Mk2vj3z4blw; Mon, 6 Dec 2021 15:56:34 +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 716946464; Mon, 6 Dec 2021 15:56:31 +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 1B6FuVVv033637; Mon, 6 Dec 2021 15:56:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B6FuVl9033636; Mon, 6 Dec 2021 15:56:31 GMT (envelope-from git) Date: Mon, 6 Dec 2021 15:56:31 GMT Message-Id: <202112061556.1B6FuVl9033636@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 66cc270f8f0f - stable/13 - cam: Remove all the write-only variables List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 66cc270f8f0f40c979e0264057a61027f58285b1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638806196; 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=CyXL5YOLze/aOHX8mW3mlLaxmK2BllKbxvA/3QKqfpE=; b=QLmv7hG9fhTncqBbTw+uI7lKjoKZpQlSPHtb4Y/OAeGqa2tyWvfGc4k/BOa4eanXPuqliX 4M1UiZs5I7Ha3fivb8PhLJazFBAbbPPFFitjBMYuCk122kRnYTVoU95AWkFCk0pYj9msRY kuSRj6pWEnfrRzJbz9ZG9bvFY/O6uiaxNpzfW1glv7+ZCmNIGbvrUQKjWwkJWtklVh6ije bzgNpBbwJPLz3GmrxdYbHFkhnOTYMxhxavu/HRn8QG0JPS3s2LbTA0nMT8V2k0Ih409gJn Ie+Zwek6KQsQgvk/uyDQ30lUIJrhz1rmvs7yzlm0/GcwNODaaU/ZD8YbaUEmSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638806196; a=rsa-sha256; cv=none; b=Vs4pTf39YxLjPBDZtxncPoSVyfZMy543j4SvrrrZZTRtjE0JoVMxy6ipmClmL5hbsYfUMh m2RbvCDDAfUsslEKtS4bAP8gp9mk+GDF/dOQedR+c2Sjmo9U9+NYWjbHVShV5DXgEhLdc9 p63YdR+QAISVUoG4KoZxj98aAe+hw+PtcTDq+XYQnHMZEhCeA2nJwrR+0sofm+iVDVX1mQ Ca0iPwYf4SIgjvhlxOlxfuGMOeKCPbll9InvND7nRWxSDJLwjl9F1DktsvZjUtk66Uhk2b l3gwxNmMGKjUrhVaVMiikWCa51T32EnXTlM4F+rEZu7eZ6jyIvOoTuLQ3IsKlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=66cc270f8f0f40c979e0264057a61027f58285b1 commit 66cc270f8f0f40c979e0264057a61027f58285b1 Author: Warner Losh AuthorDate: 2021-11-24 04:14:05 +0000 Commit: Warner Losh CommitDate: 2021-12-06 15:55:57 +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 (cherry picked from commit 6637b7460066314f9b3ce0073ec6563e15ece608) --- 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 800d6aeb291e..2aeda18ad3be 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 0c7068bf287e..460b423e469e 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 64b0947eaf8d..2599bb841345 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -735,11 +735,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 abe66e4acd35..034953494bf6 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -4516,13 +4516,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) @@ -5286,7 +5284,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")); @@ -5294,7 +5291,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; @@ -5879,12 +5875,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 d20f3dec4e52..7d3664beafdb 100644 --- a/sys/cam/scsi/scsi_enc_ses.c +++ b/sys/cam/scsi/scsi_enc_ses.c @@ -1336,7 +1336,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; @@ -1359,7 +1358,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; @@ -2867,7 +2865,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; @@ -2880,7 +2877,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 146ff8f26700..456eff641776 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -1203,7 +1203,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; @@ -1211,7 +1211,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; @@ -1250,8 +1249,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; @@ -2240,11 +2237,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)); }