Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9475cb0 authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds
Browse files

[PATCH] kfree cleanup: drivers/scsi



This is the drivers/scsi/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in drivers/scsi/.

Signed-off-by: default avatarJesper Juhl <jesper.juhl@gmail.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Acked-by: default avatarKai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 089b1dbb
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1017,7 +1017,6 @@ static void twa_free_device_extension(TW_Device_Extension *tw_dev)
				    tw_dev->generic_buffer_virt[0],
				    tw_dev->generic_buffer_phys[0]);

	if (tw_dev->event_queue[0])
	kfree(tw_dev->event_queue[0]);
} /* End twa_free_device_extension() */

+5 −9
Original line number Diff line number Diff line
@@ -1164,7 +1164,7 @@ int aac_command_thread(struct aac_dev * dev)
						kfree(hw_fib_pool);
						hw_fib_pool = NULL;
					}
				} else if (hw_fib_pool) {
				} else {
					kfree(hw_fib_pool);
					hw_fib_pool = NULL;
				}
@@ -1247,16 +1247,12 @@ int aac_command_thread(struct aac_dev * dev)
				hw_fib_p = hw_fib_pool;
				fib_p = fib_pool;
				while (hw_fib_p < &hw_fib_pool[num]) {
					if (*hw_fib_p)
					kfree(*hw_fib_p);
					if (*fib_p)
					kfree(*fib_p);
					++fib_p;
					++hw_fib_p;
				}
				if (hw_fib_pool)
				kfree(hw_fib_pool);
				if (fib_pool)
				kfree(fib_pool);
			}
			kfree(fib);
+4 −8
Original line number Diff line number Diff line
@@ -5402,10 +5402,8 @@ advansys_detect(struct scsi_host_template *tpnt)
                release_region(shp->io_port, boardp->asc_n_io_port);
                if (ASC_WIDE_BOARD(boardp)) {
                    iounmap(boardp->ioremap_addr);
                    if (boardp->orig_carrp) {
                    kfree(boardp->orig_carrp);
                    boardp->orig_carrp = NULL;
                    }
                    if (boardp->orig_reqp) {
                        kfree(boardp->orig_reqp);
                        boardp->orig_reqp = boardp->adv_reqp = NULL;
@@ -5457,10 +5455,8 @@ advansys_release(struct Scsi_Host *shp)
        adv_sgblk_t    *sgp = NULL;
        iounmap(boardp->ioremap_addr);
        if (boardp->orig_carrp) {
        kfree(boardp->orig_carrp);
        boardp->orig_carrp = NULL;
        }
        if (boardp->orig_reqp) {
            kfree(boardp->orig_reqp);
            boardp->orig_reqp = boardp->adv_reqp = NULL;
+12 −24
Original line number Diff line number Diff line
@@ -543,10 +543,8 @@ static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id, struct pt
			return;
		}
		my_done = SCtmp->scsi_done;
		if (SCtmp->host_scribble) {
		kfree(SCtmp->host_scribble);
		SCtmp->host_scribble = NULL;
		}
		/* Fetch the sense data, and tuck it away, in the required slot.  The
		   Adaptec automatically fetches it, and there is no guarantee that
		   we will still have it in the cdb when we come back */
@@ -1432,10 +1430,8 @@ static int aha1542_dev_reset(Scsi_Cmnd * SCpnt)
		    HOSTDATA(SCpnt->host)->SCint[i]->target == SCpnt->target) {
			Scsi_Cmnd *SCtmp;
			SCtmp = HOSTDATA(SCpnt->host)->SCint[i];
			if (SCtmp->host_scribble) {
			kfree(SCtmp->host_scribble);
			SCtmp->host_scribble = NULL;
			}
			HOSTDATA(SCpnt->host)->SCint[i] = NULL;
			HOSTDATA(SCpnt->host)->mb[i].status = 0;
		}
@@ -1495,10 +1491,8 @@ static int aha1542_bus_reset(Scsi_Cmnd * SCpnt)
				 */
				continue;
			}
			if (SCtmp->host_scribble) {
			kfree(SCtmp->host_scribble);
			SCtmp->host_scribble = NULL;
			}
			HOSTDATA(SCpnt->device->host)->SCint[i] = NULL;
			HOSTDATA(SCpnt->device->host)->mb[i].status = 0;
		}
@@ -1565,10 +1559,8 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
				 */
				continue;
			}
			if (SCtmp->host_scribble) {
			kfree(SCtmp->host_scribble);
			SCtmp->host_scribble = NULL;
			}
			HOSTDATA(SCpnt->device->host)->SCint[i] = NULL;
			HOSTDATA(SCpnt->device->host)->mb[i].status = 0;
		}
@@ -1711,10 +1703,8 @@ static int aha1542_old_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags)
				Scsi_Cmnd *SCtmp;
				SCtmp = HOSTDATA(SCpnt->host)->SCint[i];
				SCtmp->result = DID_RESET << 16;
				if (SCtmp->host_scribble) {
				kfree(SCtmp->host_scribble);
				SCtmp->host_scribble = NULL;
				}
				printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target);
				SCtmp->scsi_done(SCpnt);

@@ -1757,10 +1747,8 @@ static int aha1542_old_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags)
						Scsi_Cmnd *SCtmp;
						SCtmp = HOSTDATA(SCpnt->host)->SCint[i];
						SCtmp->result = DID_RESET << 16;
						if (SCtmp->host_scribble) {
						kfree(SCtmp->host_scribble);
						SCtmp->host_scribble = NULL;
						}
						printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target);
						SCtmp->scsi_done(SCpnt);

+1 −2
Original line number Diff line number Diff line
@@ -8492,7 +8492,6 @@ aic7xxx_free(struct aic7xxx_host *p)
                                     - scb_dma->dma_offset),
			    scb_dma->dma_address);
      }
      if (p->scb_data->scb_array[i]->kmalloc_ptr != NULL)
      kfree(p->scb_data->scb_array[i]->kmalloc_ptr);
      p->scb_data->scb_array[i] = NULL;
    }
Loading