diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2005-09-10 03:26:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-10 13:06:30 -0400 |
commit | f9101210e7aa72daf92722d451a2f7e3af5f781f (patch) | |
tree | 9554007e19387f2d05352ab03332be50c5b95f5b /drivers/scsi/osst.c | |
parent | 887c27f369abc458556a5ce8ab22ddd498474307 (diff) |
[PATCH] vfree and kfree cleanup in drivers/
This patch does a full cleanup of 'NULL checks before vfree', and a partial
cleanup of calls to kfree for all of drivers/ - the kfree bit is partial in
that I only did the files that also had vfree calls in them. The patch
also gets rid of some redundant (void *) casts of pointers being passed to
[vk]free, and a some tiny whitespace corrections also crept in.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/scsi/osst.c')
-rw-r--r-- | drivers/scsi/osst.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 89a4a0615c22..3f2f2464fa63 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -1377,7 +1377,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi | |||
1377 | 1377 | ||
1378 | if ((STp->buffer)->syscall_result || !SRpnt) { | 1378 | if ((STp->buffer)->syscall_result || !SRpnt) { |
1379 | printk(KERN_ERR "%s:E: Failed to read frame back from OnStream buffer\n", name); | 1379 | printk(KERN_ERR "%s:E: Failed to read frame back from OnStream buffer\n", name); |
1380 | vfree((void *)buffer); | 1380 | vfree(buffer); |
1381 | *aSRpnt = SRpnt; | 1381 | *aSRpnt = SRpnt; |
1382 | return (-EIO); | 1382 | return (-EIO); |
1383 | } | 1383 | } |
@@ -1419,7 +1419,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi | |||
1419 | 1419 | ||
1420 | if (new_frame > frame + 1000) { | 1420 | if (new_frame > frame + 1000) { |
1421 | printk(KERN_ERR "%s:E: Failed to find writable tape media\n", name); | 1421 | printk(KERN_ERR "%s:E: Failed to find writable tape media\n", name); |
1422 | vfree((void *)buffer); | 1422 | vfree(buffer); |
1423 | return (-EIO); | 1423 | return (-EIO); |
1424 | } | 1424 | } |
1425 | if ( i >= nframes + pending ) break; | 1425 | if ( i >= nframes + pending ) break; |
@@ -1500,7 +1500,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi | |||
1500 | SRpnt->sr_sense_buffer[12] == 0 && | 1500 | SRpnt->sr_sense_buffer[12] == 0 && |
1501 | SRpnt->sr_sense_buffer[13] == 2) { | 1501 | SRpnt->sr_sense_buffer[13] == 2) { |
1502 | printk(KERN_ERR "%s:E: Volume overflow in write error recovery\n", name); | 1502 | printk(KERN_ERR "%s:E: Volume overflow in write error recovery\n", name); |
1503 | vfree((void *)buffer); | 1503 | vfree(buffer); |
1504 | return (-EIO); /* hit end of tape = fail */ | 1504 | return (-EIO); /* hit end of tape = fail */ |
1505 | } | 1505 | } |
1506 | i = ((SRpnt->sr_sense_buffer[3] << 24) | | 1506 | i = ((SRpnt->sr_sense_buffer[3] << 24) | |
@@ -1525,7 +1525,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi | |||
1525 | } | 1525 | } |
1526 | if (!pending) | 1526 | if (!pending) |
1527 | osst_copy_to_buffer(STp->buffer, p); /* so buffer content == at entry in all cases */ | 1527 | osst_copy_to_buffer(STp->buffer, p); /* so buffer content == at entry in all cases */ |
1528 | vfree((void *)buffer); | 1528 | vfree(buffer); |
1529 | return 0; | 1529 | return 0; |
1530 | } | 1530 | } |
1531 | 1531 | ||
@@ -5852,7 +5852,7 @@ static int osst_remove(struct device *dev) | |||
5852 | os_scsi_tapes[i] = NULL; | 5852 | os_scsi_tapes[i] = NULL; |
5853 | osst_nr_dev--; | 5853 | osst_nr_dev--; |
5854 | write_unlock(&os_scsi_tapes_lock); | 5854 | write_unlock(&os_scsi_tapes_lock); |
5855 | if (tpnt->header_cache != NULL) vfree(tpnt->header_cache); | 5855 | vfree(tpnt->header_cache); |
5856 | if (tpnt->buffer) { | 5856 | if (tpnt->buffer) { |
5857 | normalize_buffer(tpnt->buffer); | 5857 | normalize_buffer(tpnt->buffer); |
5858 | kfree(tpnt->buffer); | 5858 | kfree(tpnt->buffer); |
@@ -5896,8 +5896,7 @@ static void __exit exit_osst (void) | |||
5896 | for (i=0; i < osst_max_dev; ++i) { | 5896 | for (i=0; i < osst_max_dev; ++i) { |
5897 | if (!(STp = os_scsi_tapes[i])) continue; | 5897 | if (!(STp = os_scsi_tapes[i])) continue; |
5898 | /* This is defensive, supposed to happen during detach */ | 5898 | /* This is defensive, supposed to happen during detach */ |
5899 | if (STp->header_cache) | 5899 | vfree(STp->header_cache); |
5900 | vfree(STp->header_cache); | ||
5901 | if (STp->buffer) { | 5900 | if (STp->buffer) { |
5902 | normalize_buffer(STp->buffer); | 5901 | normalize_buffer(STp->buffer); |
5903 | kfree(STp->buffer); | 5902 | kfree(STp->buffer); |