aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ibmvscsi/ibmvstgt.c18
-rw-r--r--drivers/scsi/libsrp.c12
2 files changed, 15 insertions, 15 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index a7fbd10817a0..84363c181620 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -35,7 +35,7 @@
35#include "ibmvscsi.h" 35#include "ibmvscsi.h"
36 36
37#define INITIAL_SRP_LIMIT 16 37#define INITIAL_SRP_LIMIT 16
38#define DEFAULT_MAX_SECTORS 512 38#define DEFAULT_MAX_SECTORS 256
39 39
40#define TGT_NAME "ibmvstgt" 40#define TGT_NAME "ibmvstgt"
41 41
@@ -248,8 +248,8 @@ static int ibmvstgt_rdma(struct scsi_cmnd *sc, struct scatterlist *sg, int nsg,
248 md[i].va + mdone); 248 md[i].va + mdone);
249 249
250 if (err != H_SUCCESS) { 250 if (err != H_SUCCESS) {
251 eprintk("rdma error %d %d\n", dir, slen); 251 eprintk("rdma error %d %d %ld\n", dir, slen, err);
252 goto out; 252 return -EIO;
253 } 253 }
254 254
255 mlen -= slen; 255 mlen -= slen;
@@ -265,14 +265,13 @@ static int ibmvstgt_rdma(struct scsi_cmnd *sc, struct scatterlist *sg, int nsg,
265 if (sidx > nsg) { 265 if (sidx > nsg) {
266 eprintk("out of sg %p %d %d\n", 266 eprintk("out of sg %p %d %d\n",
267 iue, sidx, nsg); 267 iue, sidx, nsg);
268 goto out; 268 return -EIO;
269 } 269 }
270 } 270 }
271 }; 271 };
272 272
273 rest -= mlen; 273 rest -= mlen;
274 } 274 }
275out:
276 return 0; 275 return 0;
277} 276}
278 277
@@ -282,18 +281,19 @@ static int ibmvstgt_cmd_done(struct scsi_cmnd *sc,
282 unsigned long flags; 281 unsigned long flags;
283 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr; 282 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
284 struct srp_target *target = iue->target; 283 struct srp_target *target = iue->target;
284 int err = 0;
285 285
286 dprintk("%p %p %x %u\n", iue, target, vio_iu(iue)->srp.cmd.cdb[0], 286 dprintk("%p %p %x %u\n", iue, target, vio_iu(iue)->srp.cmd.cdb[0],
287 cmd->usg_sg); 287 cmd->usg_sg);
288 288
289 if (sc->use_sg) 289 if (sc->use_sg)
290 srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1); 290 err = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1);
291 291
292 spin_lock_irqsave(&target->lock, flags); 292 spin_lock_irqsave(&target->lock, flags);
293 list_del(&iue->ilist); 293 list_del(&iue->ilist);
294 spin_unlock_irqrestore(&target->lock, flags); 294 spin_unlock_irqrestore(&target->lock, flags);
295 295
296 if (sc->result != SAM_STAT_GOOD) { 296 if (err|| sc->result != SAM_STAT_GOOD) {
297 eprintk("operation failed %p %d %x\n", 297 eprintk("operation failed %p %d %x\n",
298 iue, sc->result, vio_iu(iue)->srp.cmd.cdb[0]); 298 iue, sc->result, vio_iu(iue)->srp.cmd.cdb[0]);
299 send_rsp(iue, sc, HARDWARE_ERROR, 0x00); 299 send_rsp(iue, sc, HARDWARE_ERROR, 0x00);
@@ -493,7 +493,8 @@ static void process_iu(struct viosrp_crq *crq, struct srp_target *target)
493{ 493{
494 struct vio_port *vport = target_to_port(target); 494 struct vio_port *vport = target_to_port(target);
495 struct iu_entry *iue; 495 struct iu_entry *iue;
496 long err, done; 496 long err;
497 int done = 1;
497 498
498 iue = srp_iu_get(target); 499 iue = srp_iu_get(target);
499 if (!iue) { 500 if (!iue) {
@@ -508,7 +509,6 @@ static void process_iu(struct viosrp_crq *crq, struct srp_target *target)
508 509
509 if (err != H_SUCCESS) { 510 if (err != H_SUCCESS) {
510 eprintk("%ld transferring data error %p\n", err, iue); 511 eprintk("%ld transferring data error %p\n", err, iue);
511 done = 1;
512 goto out; 512 goto out;
513 } 513 }
514 514
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c
index 89403b00e042..37a0f4dd6186 100644
--- a/drivers/scsi/libsrp.c
+++ b/drivers/scsi/libsrp.c
@@ -225,8 +225,7 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
225 struct srp_direct_buf *md = NULL; 225 struct srp_direct_buf *md = NULL;
226 struct scatterlist dummy, *sg = NULL; 226 struct scatterlist dummy, *sg = NULL;
227 dma_addr_t token = 0; 227 dma_addr_t token = 0;
228 long err; 228 int err = 0;
229 unsigned int done = 0;
230 int nmd, nsg = 0, len; 229 int nmd, nsg = 0, len;
231 230
232 if (dma_map || ext_desc) { 231 if (dma_map || ext_desc) {
@@ -258,8 +257,8 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
258 sg_dma_address(&dummy) = token; 257 sg_dma_address(&dummy) = token;
259 err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, 258 err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE,
260 id->table_desc.len); 259 id->table_desc.len);
261 if (err < 0) { 260 if (err) {
262 eprintk("Error copying indirect table %ld\n", err); 261 eprintk("Error copying indirect table %d\n", err);
263 goto free_mem; 262 goto free_mem;
264 } 263 }
265 } else { 264 } else {
@@ -272,6 +271,7 @@ rdma:
272 nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, DMA_BIDIRECTIONAL); 271 nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, DMA_BIDIRECTIONAL);
273 if (!nsg) { 272 if (!nsg) {
274 eprintk("fail to map %p %d\n", iue, sc->use_sg); 273 eprintk("fail to map %p %d\n", iue, sc->use_sg);
274 err = -EIO;
275 goto free_mem; 275 goto free_mem;
276 } 276 }
277 len = min(sc->request_bufflen, id->len); 277 len = min(sc->request_bufflen, id->len);
@@ -287,7 +287,7 @@ free_mem:
287 if (token && dma_map) 287 if (token && dma_map)
288 dma_free_coherent(iue->target->dev, id->table_desc.len, md, token); 288 dma_free_coherent(iue->target->dev, id->table_desc.len, md, token);
289 289
290 return done; 290 return err;
291} 291}
292 292
293static int data_out_desc_size(struct srp_cmd *cmd) 293static int data_out_desc_size(struct srp_cmd *cmd)
@@ -352,7 +352,7 @@ int srp_transfer_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
352 break; 352 break;
353 default: 353 default:
354 eprintk("Unknown format %d %x\n", dir, format); 354 eprintk("Unknown format %d %x\n", dir, format);
355 break; 355 err = -EINVAL;
356 } 356 }
357 357
358 return err; 358 return err;