Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1370852 > unrolled thread
| Started by | Ming Lin <mlin@kernel.org> |
|---|---|
| First post | 2016-04-04 22:20 +0200 |
| Last post | 2016-04-04 22:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2 5/5] lib: scatterlist: move SG pool code from SCSI driver to lib/sg_pool.c Ming Lin <mlin@kernel.org> - 2016-04-04 22:20 +0200
Re: [PATCH v2 5/5] lib: scatterlist: move SG pool code from SCSI driver to lib/sg_pool.c Christoph Hellwig <hch@lst.de> - 2016-04-04 22:20 +0200
Re: [PATCH v2 5/5] lib: scatterlist: move SG pool code from SCSI driver to lib/sg_pool.c Ming Lin <mlin@kernel.org> - 2016-04-04 22:30 +0200
| From | Ming Lin <mlin@kernel.org> |
|---|---|
| Date | 2016-04-04 22:20 +0200 |
| Subject | Re: [PATCH v2 5/5] lib: scatterlist: move SG pool code from SCSI driver to lib/sg_pool.c |
| Message-ID | <rkj8B-97-5@gated-at.bofh.it> |
On Tue, Mar 22, 2016 at 7:38 PM, kbuild test robot <lkp@intel.com> wrote:
> Hi Ming,
>
> [auto build test WARNING on scsi/for-next]
> [also build test WARNING on v4.5 next-20160322]
> [if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
>
> url: https://github.com/0day-ci/linux/commits/Ming-Lin/mempool-based-chained-scatterlist-alloc-free-api/20160323-060710
> base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
>
>
> coccinelle warnings: (new ones prefixed by >>)
>
>>> lib/sg_pool.c:152:3-18: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.
> lib/sg_pool.c:154:3-21: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.
mempool_destroy()/kmem_cache_destroy() is OK to accept NULL pointer.
But the logic is more readable that we do NULL check when cleanup due to error.
cleanup_sdb:
for (i = 0; i < SG_MEMPOOL_NR; i++) {
struct sg_pool *sgp = sg_pools + i;
if (sgp->pool)
mempool_destroy(sgp->pool);
if (sgp->slab)
kmem_cache_destroy(sgp->slab);
}
I'll keep the NULL check if no objection.
Thanks.
[toc] | [next] | [standalone]
| From | Christoph Hellwig <hch@lst.de> |
|---|---|
| Date | 2016-04-04 22:20 +0200 |
| Message-ID | <rkj8B-97-11@gated-at.bofh.it> |
| In reply to | #1370852 |
On Mon, Apr 04, 2016 at 01:15:45PM -0700, Ming Lin wrote:
> cleanup_sdb:
> for (i = 0; i < SG_MEMPOOL_NR; i++) {
> struct sg_pool *sgp = sg_pools + i;
> if (sgp->pool)
> mempool_destroy(sgp->pool);
> if (sgp->slab)
> kmem_cache_destroy(sgp->slab);
> }
>
> I'll keep the NULL check if no objection.
I don't necessarily, but given that this is a code move I'd prefer
to keep the code as similar as possible in the actual move patch..
[toc] | [prev] | [next] | [standalone]
| From | Ming Lin <mlin@kernel.org> |
|---|---|
| Date | 2016-04-04 22:30 +0200 |
| Message-ID | <rkjik-dT-47@gated-at.bofh.it> |
| In reply to | #1370854 |
On Mon, Apr 4, 2016 at 1:17 PM, Christoph Hellwig <hch@lst.de> wrote:
> On Mon, Apr 04, 2016 at 01:15:45PM -0700, Ming Lin wrote:
>> cleanup_sdb:
>> for (i = 0; i < SG_MEMPOOL_NR; i++) {
>> struct sg_pool *sgp = sg_pools + i;
>> if (sgp->pool)
>> mempool_destroy(sgp->pool);
>> if (sgp->slab)
>> kmem_cache_destroy(sgp->slab);
>> }
>>
>> I'll keep the NULL check if no objection.
>
> I don't necessarily, but given that this is a code move I'd prefer
> to keep the code as similar as possible in the actual move patch..
So I'll just keep it.
And I can send a cleanup patch after this series applied.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web