ipack: tpci200: fix memory leak in the tpci200_register
authorDongliang Mu <mudongliangabcd@gmail.com>
Tue, 10 Aug 2021 10:03:19 +0000 (18:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Aug 2021 08:24:37 +0000 (10:24 +0200)
commit50f05bd114a46a74726e432bf81079d3f13a55b7
tree17466bf6513ff3f45251fe7990738e4f85925040
parent57a1681095f912239c7fb4d66683ab0425973838
ipack: tpci200: fix memory leak in the tpci200_register

The error handling code in tpci200_register does not free interface_regs
allocated by ioremap and the current version of error handling code is
problematic.

Fix this by refactoring the error handling code and free interface_regs
when necessary.

Fixes: 43986798fd50 ("ipack: add error handling for ioremap_nocache")
Cc: stable@vger.kernel.org
Reported-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Link: https://lore.kernel.org/r/20210810100323.3938492-2-mudongliangabcd@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ipack/carriers/tpci200.c