mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 23:50:27 +00:00
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
This commit is contained in:
parent
09f1ead230
commit
6637b74600
|
@ -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:
|
||||
|
|
|
@ -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 @@ nvme_probe_done(struct cam_periph *periph, union ccb *done_ccb)
|
|||
/* 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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue