Skip to contentSkip to conversation

drm/nouveau/bios: fix incorrect kfree in platform_init

PATCH New wuxu.wu 1 participant 1 message Dec 20, 2019

Subsystems (3)
lore
Share & tools
lore

wuxu.wu

author
#0 lore raw

PATCH 1/1 drm/nouveau/bios: fix incorrect kfree in platform_init

priv porinter could be free only when priv != null and priv->rom is null.

---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c +2 -1
index 9b91da0..d776e01 100644
@@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
 			    (priv->rom = pci_map_rom(pdev, &priv->size))) {
 				priv->pdev = pdev;
 				return priv;
+			} else {
+			    kfree(priv);
 			}
-			kfree(priv);
 		}
 		pci_disable_rom(pdev);
 	}
Signature · 1 line
2.7.4