[][kernel][mt7988][eip197][Fix memory leaks of eip197_load_firmwares]
[Description]
Fix memory leaks of eip197_load_firmwares.
Add release_firmware to release firmware resource.
[Release-log]
N/A
Change-Id: I970c8d2161d3bd309e49495d4a2685b32e14233e
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6701917
diff --git a/target/linux/mediatek/patches-5.4/0505-crypto-add-eip197-inside-secure-support.patch b/target/linux/mediatek/patches-5.4/0505-crypto-add-eip197-inside-secure-support.patch
index eff209b..8b9ccce 100644
--- a/target/linux/mediatek/patches-5.4/0505-crypto-add-eip197-inside-secure-support.patch
+++ b/target/linux/mediatek/patches-5.4/0505-crypto-add-eip197-inside-secure-support.patch
@@ -28,7 +28,17 @@
else
return -ENODEV;
-@@ -592,6 +597,11 @@
+@@ -442,6 +447,9 @@
+
+ ipuesz = eip197_write_firmware(priv, fw[FW_IPUE]);
+
++ for (j = 0; j < i; j++)
++ release_firmware(fw[j]);
++
+ if (eip197_start_firmware(priv, ipuesz, ifppsz, minifw)) {
+ dev_dbg(priv->dev, "Firmware loaded successfully\n");
+ return 0;
+@@ -592,6 +600,11 @@
*/
if (priv->flags & SAFEXCEL_HW_EIP197) {
val = readl(EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
@@ -40,7 +50,7 @@
val |= EIP197_MST_CTRL_TX_MAX_CMD(5);
writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
}
-@@ -792,6 +802,12 @@
+@@ -792,6 +805,12 @@
return ret;
}
@@ -53,7 +63,7 @@
return safexcel_hw_setup_cdesc_rings(priv) ?:
safexcel_hw_setup_rdesc_rings(priv) ?:
0;
-@@ -1498,6 +1514,9 @@
+@@ -1498,6 +1517,9 @@
hwopt = readl(EIP197_GLOBAL(priv) + EIP197_OPTIONS);
hiaopt = readl(EIP197_HIA_AIC(priv) + EIP197_HIA_OPTIONS);
@@ -63,7 +73,7 @@
if (priv->flags & SAFEXCEL_HW_EIP197) {
/* EIP197 */
peopt = readl(EIP197_PE(priv) + EIP197_PE_OPTIONS(0));
-@@ -1516,8 +1535,37 @@
+@@ -1516,8 +1538,37 @@
EIP197_N_RINGS_MASK;
if (hiaopt & EIP197_HIA_OPT_HAS_PE_ARB)
priv->flags |= EIP197_PE_ARB;
@@ -102,7 +112,7 @@
/* If not a full TRC, then assume simple TRC */
if (!(hwopt & EIP197_OPT_HAS_TRC))
priv->flags |= EIP197_SIMPLE_TRC;
-@@ -1555,13 +1603,14 @@
+@@ -1555,13 +1606,14 @@
EIP197_PE_EIP96_OPTIONS(0));
/* Print single info line describing what we just detected */
@@ -119,7 +129,7 @@
safexcel_configure(priv);
-@@ -1690,6 +1739,7 @@
+@@ -1690,6 +1742,7 @@
{
struct device *dev = &pdev->dev;
struct safexcel_crypto_priv *priv;
@@ -127,7 +137,7 @@
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-@@ -1701,7 +1751,11 @@
+@@ -1701,7 +1754,11 @@
platform_set_drvdata(pdev, priv);