Re: [PATCH 06/27] habanalabs: use memhash_node_export_put() in hl_release_dmabuf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 16, 2023 at 02:26:50PM +0000, Tomer Tayar wrote:
> > This looks suspicious, I think hnode can be not-NULL here and has
> > hnode->vaddr different than searched addr, in case there is
> > hash collision and we iterate over hlist where there is no
> > searched addr. Not 100% sure about that though.
> > 
> > I think would be better to provide helper like this:
> > 
> > 	hash_for_each_possible(ctx->mem_hash, hnode, node, (unsigned
> > long)addr)
> > 		if (addr == hnode->vaddr)
> > 			return hnode;
> > 	return NULL;
> > 
> > which is basically standard way how hash_for_each_possible() used.
> > 
> > 
> > Regards
> > Stanislaw
> 
> Thanks Stanislaw, we will add such a helper and use it here and in another place with a similar pattern.
> If that is okay, we will do it in another patch, as this one only moves an existing function for code reuse.

Sure, no problem with that.

Regards
Stanislaw




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux