IB/hfi1: Fix tstats alloc and dealloc
authorMike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Sat, 15 Jan 2022 23:02:36 +0000 (18:02 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Feb 2022 17:34:08 +0000 (18:34 +0100)
commit40e20ba90390ff65600fbbf1618e3228a7210079
treebd1fe077a4727a66965f63011ed3ba9d3debd5d2
parentdd00b4f8f768d81c3788a8ac88fdb3d745e55ea3
IB/hfi1: Fix tstats alloc and dealloc

commit e5cce44aff3be9ad2cd52f63f35edbd706181d50 upstream.

The tstats allocation is done in the accelerated ndo_init function but the
allocation is not tested to succeed.

The deallocation is not done in the accelerated ndo_uninit function.

Resolve issues by testing for an allocation failure and adding the
free_percpu in the uninit function.

Fixes: aa0616a9bd52 ("IB/hfi1: switch to core handling of rx/tx byte/packet counters")
Link: https://lore.kernel.org/r/1642287756-182313-5-git-send-email-mike.marciniszyn@cornelisnetworks.com
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/hfi1/ipoib_main.c