Merge tag 'drivers-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-microblaze.git] / drivers / soc / qcom / qcom_aoss.c
index 934fcc4..536c3e4 100644 (file)
@@ -476,12 +476,12 @@ static int qmp_cooling_device_add(struct qmp *qmp,
 static int qmp_cooling_devices_register(struct qmp *qmp)
 {
        struct device_node *np, *child;
-       int count = QMP_NUM_COOLING_RESOURCES;
+       int count = 0;
        int ret;
 
        np = qmp->dev->of_node;
 
-       qmp->cooling_devs = devm_kcalloc(qmp->dev, count,
+       qmp->cooling_devs = devm_kcalloc(qmp->dev, QMP_NUM_COOLING_RESOURCES,
                                         sizeof(*qmp->cooling_devs),
                                         GFP_KERNEL);
 
@@ -497,12 +497,16 @@ static int qmp_cooling_devices_register(struct qmp *qmp)
                        goto unroll;
        }
 
+       if (!count)
+               devm_kfree(qmp->dev, qmp->cooling_devs);
+
        return 0;
 
 unroll:
        while (--count >= 0)
                thermal_cooling_device_unregister
                        (qmp->cooling_devs[count].cdev);
+       devm_kfree(qmp->dev, qmp->cooling_devs);
 
        return ret;
 }
@@ -602,6 +606,7 @@ static const struct of_device_id qmp_dt_match[] = {
        { .compatible = "qcom,sm8150-aoss-qmp", },
        { .compatible = "qcom,sm8250-aoss-qmp", },
        { .compatible = "qcom,sm8350-aoss-qmp", },
+       { .compatible = "qcom,aoss-qmp", },
        {}
 };
 MODULE_DEVICE_TABLE(of, qmp_dt_match);