cxl: Fix wrong comparison in cxl_adapter_context_get()

Michael Ellerman patch-notifications at ellerman.id.au
Tue Jul 24 01:11:16 AEST 2018


On Wed, 2018-07-04 at 15:28:33 UTC, Vaibhav Jain wrote:
> Function atomic_inc_unless_negative() returns a bool to indicate
> success/failure. However cxl_adapter_context_get() wrongly compares
> the return value against '>=0' which will always be true. The patch
> fixes this comparison to '==0' there by also fixing this compile time
> warning:
> 
> 	drivers/misc/cxl/main.c:290 cxl_adapter_context_get()
> 	warn: 'atomic_inc_unless_negative(&adapter->contexts_num)' is unsigned
> 
> Cc: stable at vger.kernel.org
> Fixes: 70b565bbdb91 ("cxl: Prevent adapter reset if an active context exists")
> Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
> Signed-off-by: Vaibhav Jain <vaibhav at linux.ibm.com>
> Acked-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
> Acked-by: Frederic Barrat <fbarrat at linux.vnet.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/ef6cb5f1a048fdf91ccee6d63d2bfa

cheers


More information about the Linuxppc-dev mailing list