mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
Patch from Bart Van Assche <bart.vanassche@gmail.com>:
The patch below fixes the checkpatch complaints on kfree(): WARNING: kfree(NULL) is safe this check is probabally not required This patch has been verified as follows: - Verified that checkpatch does no longer complain about kfree(). - Verified that make -s clean && make -s iscsi scst && make -s -C srpt still works and does not trigger any new compiler warnings. - Checked that the patch generated by generate-kernel-patch still applies cleanly to the 2.6.25.4 kernel, and that the patched kernel tree still compiles, installs and boots fine, and that the iscsi-scst, ib_srpt, scst_disk and scst_vdisk modules still load. Note: I'm not sure any of the above verifications did trigger the code paths changed by this patch. Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@402 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -4592,8 +4592,7 @@ mpt_stm_adapter_install(MPT_ADAPTER *ioc)
|
||||
if (priv == NULL) {
|
||||
printk(KERN_ERR MYNAM
|
||||
":%s failed to allocate private structure\n", ioc->name);
|
||||
if (priv != NULL)
|
||||
kfree(priv);
|
||||
kfree(priv);
|
||||
return (-1);
|
||||
}
|
||||
memset(priv, 0, sizeof(*priv));
|
||||
|
||||
@@ -548,8 +548,7 @@ static void vdisk_free_thr_data(struct scst_thr_data_hdr *d)
|
||||
if (thr->fd)
|
||||
filp_close(thr->fd, NULL);
|
||||
|
||||
if (thr->iv != NULL)
|
||||
kfree(thr->iv);
|
||||
kfree(thr->iv);
|
||||
|
||||
kmem_cache_free(vdisk_thr_cachep, thr);
|
||||
|
||||
@@ -1926,8 +1925,7 @@ static struct iovec *vdisk_alloc_iv(struct scst_cmd *cmd,
|
||||
|
||||
iv_count = scst_get_buf_count(cmd);
|
||||
if (iv_count > thr->iv_count) {
|
||||
if (thr->iv != NULL)
|
||||
kfree(thr->iv);
|
||||
kfree(thr->iv);
|
||||
thr->iv = kmalloc(sizeof(*thr->iv) * iv_count, GFP_KERNEL);
|
||||
if (thr->iv == NULL) {
|
||||
PRINT_ERROR("Unable to allocate iv (%d)", iv_count);
|
||||
@@ -3011,8 +3009,7 @@ static int vcdrom_close(char *name)
|
||||
|
||||
list_del(&virt_dev->vdisk_dev_list_entry);
|
||||
|
||||
if (virt_dev->file_name)
|
||||
kfree(virt_dev->file_name);
|
||||
kfree(virt_dev->file_name);
|
||||
kfree(virt_dev);
|
||||
|
||||
out:
|
||||
@@ -3148,8 +3145,7 @@ static int vcdrom_change(char *p, char *name)
|
||||
virt_dev->name);
|
||||
}
|
||||
|
||||
if (old_fn)
|
||||
kfree(old_fn);
|
||||
kfree(old_fn);
|
||||
|
||||
out_resume:
|
||||
scst_resume_activity();
|
||||
|
||||
@@ -352,8 +352,7 @@ out:
|
||||
return tgt;
|
||||
|
||||
out_free_name:
|
||||
if (tgt->default_group_name)
|
||||
kfree(tgt->default_group_name);
|
||||
kfree(tgt->default_group_name);
|
||||
|
||||
out_free_err:
|
||||
mutex_unlock(&scst_mutex);
|
||||
@@ -406,8 +405,7 @@ void scst_unregister(struct scst_tgt *tgt)
|
||||
|
||||
scst_cleanup_proc_target_entries(tgt);
|
||||
|
||||
if (tgt->default_group_name)
|
||||
kfree(tgt->default_group_name);
|
||||
kfree(tgt->default_group_name);
|
||||
|
||||
mutex_unlock(&scst_mutex);
|
||||
scst_resume_activity();
|
||||
|
||||
@@ -614,14 +614,12 @@ static void srpt_reset_ioctx(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx)
|
||||
if (ioctx->n_rdma_ius > 0 && ioctx->rdma_ius) {
|
||||
struct rdma_iu *riu = ioctx->rdma_ius;
|
||||
|
||||
for (i = 0; i < ioctx->n_rdma_ius; ++i, ++riu) {
|
||||
if (riu->sge)
|
||||
kfree(riu->sge);
|
||||
}
|
||||
for (i = 0; i < ioctx->n_rdma_ius; ++i, ++riu)
|
||||
kfree(riu->sge);
|
||||
kfree(ioctx->rdma_ius);
|
||||
}
|
||||
|
||||
if (ioctx->n_rbuf > 1 && ioctx->rbufs)
|
||||
if (ioctx->n_rbuf > 1)
|
||||
kfree(ioctx->rbufs);
|
||||
|
||||
if (srpt_post_recv(ch->sport->sdev, ioctx))
|
||||
|
||||
Reference in New Issue
Block a user