diff options
author | Alexander Motin <mav@FreeBSD.org> | 2019-02-11 14:50:12 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2019-02-11 14:50:12 +0000 |
commit | 3ca4ded3abff62c224d603b9fd181d361e36ccf2 (patch) | |
tree | fe2b1c07627e7400b8f01029d3058ffdf436568f /sys/cam/scsi | |
parent | 524230db14b32fadc1aa3b9f03377eff7029527e (diff) | |
download | src-test2-3ca4ded3abff62c224d603b9fd181d361e36ccf2.tar.gz src-test2-3ca4ded3abff62c224d603b9fd181d361e36ccf2.zip |
Notes
Diffstat (limited to 'sys/cam/scsi')
-rw-r--r-- | sys/cam/scsi/scsi_enc_ses.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/cam/scsi/scsi_enc_ses.c b/sys/cam/scsi/scsi_enc_ses.c index 2aee34b49a8d..85acf1124730 100644 --- a/sys/cam/scsi/scsi_enc_ses.c +++ b/sys/cam/scsi/scsi_enc_ses.c @@ -2727,13 +2727,13 @@ ses_handle_string(enc_softc_t *enc, encioc_string_t *sstr, int ioc) if (sstr->bufsiz > 0xffff) return (EINVAL); /* buffer size too large */ - if (ioc == ENCIOC_SETSTRING) { + switch (ioc) { + case ENCIOC_SETSTRING: payload = sstr->bufsiz + 4; /* header for SEND DIAGNOSTIC */ amt = 0 - payload; buf = ENC_MALLOC(payload); if (buf == NULL) - return ENOMEM; - + return (ENOMEM); ses_page_cdb(cdb, payload, 0, CAM_DIR_OUT); /* Construct the page request */ buf[0] = SesStringOut; @@ -2741,12 +2741,14 @@ ses_handle_string(enc_softc_t *enc, encioc_string_t *sstr, int ioc) buf[2] = sstr->bufsiz >> 8; buf[3] = sstr->bufsiz & 0xff; memcpy(&buf[4], sstr->buf, sstr->bufsiz); - } else if (ioc == ENCIOC_GETSTRING) { + break; + case ENCIOC_GETSTRING: payload = sstr->bufsiz; amt = payload; ses_page_cdb(cdb, payload, SesStringIn, CAM_DIR_IN); buf = sstr->buf; - } else if (ioc == ENCIOC_GETENCNAME) { + break; + case ENCIOC_GETENCNAME: if (ses_cache->ses_nsubencs < 1) return (ENODEV); enc_desc = ses_cache->subencs[0]; @@ -2766,7 +2768,7 @@ ses_handle_string(enc_softc_t *enc, encioc_string_t *sstr, int ioc) size = sstr->bufsiz; copyout(str, sstr->buf, size); return (size == rsize ? 0 : ENOMEM); - } else if (ioc == ENCIOC_GETENCID) { + case ENCIOC_GETENCID: if (ses_cache->ses_nsubencs < 1) return (ENODEV); enc_desc = ses_cache->subencs[0]; @@ -2780,13 +2782,13 @@ ses_handle_string(enc_softc_t *enc, encioc_string_t *sstr, int ioc) size = sstr->bufsiz; copyout(str, sstr->buf, size); return (size == rsize ? 0 : ENOMEM); - } else - return EINVAL; - + default: + return (EINVAL); + } ret = enc_runcmd(enc, cdb, 6, buf, &amt); if (ioc == ENCIOC_SETSTRING) ENC_FREE(buf); - return ret; + return (ret); } /** |