Prechádzať zdrojové kódy

Merge "asoc: codec: wcd937x: fix memory leak in wcd937x_bind()"

qctecmdr 1 rok pred
rodič
commit
a3126f08c6
1 zmenil súbory, kde vykonal 4 pridanie a 2 odobranie
  1. 4 2
      asoc/codecs/wcd937x/wcd937x.c

+ 4 - 2
asoc/codecs/wcd937x/wcd937x.c

@@ -3358,7 +3358,8 @@ static int wcd937x_bind(struct device *dev)
 	pdata = wcd937x_populate_dt_data(dev);
 	if (!pdata) {
 		dev_err(dev, "%s: Fail to obtain platform data\n", __func__);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_pdata;
 	}
 	wcd937x->dev = dev;
 	wcd937x->dev->platform_data = pdata;
@@ -3524,8 +3525,9 @@ err_irq:
 err:
 	component_unbind_all(dev, wcd937x);
 err_bind_all:
-	dev_set_drvdata(dev, NULL);
 	kfree(pdata);
+err_pdata:
+	dev_set_drvdata(dev, NULL);
 	kfree(wcd937x);
 	return ret;
 }