wifi: meson: fix kernel panic when dts not config wifi pwms
authorlibo <bo.li@amlogic.com>
Mon, 16 Jul 2018 08:12:47 +0000 (16:12 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Wed, 18 Jul 2018 09:51:58 +0000 (02:51 -0700)
PD#168480: wifi: fix kernel panic when dts not config wifi pwms

Change-Id: I8907ec9f131034fbbe113e74ff3a760b6b8169e1
Signed-off-by: libo <bo.li@amlogic.com>
drivers/amlogic/wifi/wifi_dt.c

index 98cd411662c8859f133ee83fa5dcabedcd980f0e..304f491db272b31842f5e85ffc92b375df832158 100644 (file)
@@ -491,6 +491,7 @@ int pwm_double_channel_conf_dt(struct wifi_plat_info *plat)
        ret = of_property_read_u32(wifinode, "pwm_config", &pwm_phandle);
        if (ret) {
                pr_err("not match wifi_pwm_config node\n");
+               return -1;
        } else {
                pnode = of_find_node_by_phandle(pwm_phandle);
                if (!pnode) {
@@ -656,11 +657,13 @@ static int wifi_dev_probe(struct platform_device *pdev)
 
                if (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXTVBB) {
                        ret = pwm_double_channel_conf_dt(plat);
-                       if (ret != 0)
+                       if (ret != 0) {
                                WIFI_INFO("pwm_double_channel_conf_dt error\n");
-                       ret = pwm_double_channel_conf(plat);
-                       if (ret != 0)
-                               WIFI_INFO("pwm_double_channel_conf error\n");
+                       } else {
+                               ret = pwm_double_channel_conf(plat);
+                               if (ret != 0)
+                                       WIFI_INFO("pwm_double_channel_conf error\n");
+                       }
                } else if (get_cpu_type() == MESON_CPU_MAJOR_ID_GXBB) {
                        ret = pwm_single_channel_conf(plat);
                        if (ret)