PCI: xilinx-nwl: Simplify code and fix a memory leak
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 7 Nov 2021 10:04:43 +0000 (11:04 +0100)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Wed, 1 Dec 2021 09:26:51 +0000 (09:26 +0000)
commit61f0aa4da397bdb00907c95ae21ef27090137409
tree120a1446a81e2422368ab2ee0302b943d4f85141
parentfa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf
PCI: xilinx-nwl: Simplify code and fix a memory leak

Allocate space for bitmap in struct nwl_msi at probe time instead of
dynamically allocating the memory at runtime.

This simplifies code (especially error handling paths) and avoid some
open-coded arithmetic in allocator arguments.

This also fixes a potential memory leak. The bitmap was never freed. It
is now part of a managed resource.

Link: https://lore.kernel.org/r/5483f10a44b06aad55728576d489adfa16c3be91.1636279388.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Krzysztof WilczyƄski <kw@linux.com>
drivers/pci/controller/pcie-xilinx-nwl.c