Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] fnic: remove redundant BUG_ONs and fix checks on unsigned

The shost sg tablesize is set to FNIC_MAX_SG_DESC_CNT and fnic uses
scsi_dma_map, so both BUG_ONs can be removed.

scsi_dma_map may return -ENOMEM, sg_count should be int to catch that.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

authored by

Roel Kluin and committed by
James Bottomley
87a2d34b e08afeb7

+2 -5
+2 -5
drivers/scsi/fnic/fnic_scsi.c
··· 245 245 struct vnic_wq_copy *wq, 246 246 struct fnic_io_req *io_req, 247 247 struct scsi_cmnd *sc, 248 - u32 sg_count) 248 + int sg_count) 249 249 { 250 250 struct scatterlist *sg; 251 251 struct fc_rport *rport = starget_to_rport(scsi_target(sc->device)); ··· 260 260 char msg[2]; 261 261 262 262 if (sg_count) { 263 - BUG_ON(sg_count < 0); 264 - BUG_ON(sg_count > FNIC_MAX_SG_DESC_CNT); 265 - 266 263 /* For each SGE, create a device desc entry */ 267 264 desc = io_req->sgl_list; 268 265 for_each_sg(scsi_sglist(sc), sg, sg_count, i) { ··· 341 344 struct fnic *fnic; 342 345 struct vnic_wq_copy *wq; 343 346 int ret; 344 - u32 sg_count; 347 + int sg_count; 345 348 unsigned long flags; 346 349 unsigned long ptr; 347 350