From: <vl...@us...> - 2008-05-29 17:24:22
|
Revision: 402 http://scst.svn.sourceforge.net/scst/?rev=402&view=rev Author: vlnb Date: 2008-05-29 10:24:18 -0700 (Thu, 29 May 2008) Log Message: ----------- Patch from Bart Van Assche <bar...@gm...>: 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 <bar...@gm...> Modified Paths: -------------- trunk/mpt/mpt_scst.c trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_main.c trunk/srpt/src/ib_srpt.c Modified: trunk/mpt/mpt_scst.c =================================================================== --- trunk/mpt/mpt_scst.c 2008-05-28 11:17:08 UTC (rev 401) +++ trunk/mpt/mpt_scst.c 2008-05-29 17:24:18 UTC (rev 402) @@ -4592,8 +4592,7 @@ 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)); Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-28 11:17:08 UTC (rev 401) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2008-05-29 17:24:18 UTC (rev 402) @@ -548,8 +548,7 @@ 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 @@ 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 @@ 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 @@ virt_dev->name); } - if (old_fn) - kfree(old_fn); + kfree(old_fn); out_resume: scst_resume_activity(); Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2008-05-28 11:17:08 UTC (rev 401) +++ trunk/scst/src/scst_main.c 2008-05-29 17:24:18 UTC (rev 402) @@ -352,8 +352,7 @@ 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 @@ 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(); Modified: trunk/srpt/src/ib_srpt.c =================================================================== --- trunk/srpt/src/ib_srpt.c 2008-05-28 11:17:08 UTC (rev 401) +++ trunk/srpt/src/ib_srpt.c 2008-05-29 17:24:18 UTC (rev 402) @@ -614,14 +614,12 @@ 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)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |