Parcourir la source

cnss2: Add NULL check for 'dev' pointer

Add NULL check for 'dev' pointer before passing to
cnss_bus_dev_to_plat_priv function.

Change-Id: I319a9859c41d7e8096b3a4457f4a831e0e93f7ab
CRs-Fixed: 3360223
Sai Kumar Kunchala il y a 2 ans
Parent
commit
1def1b7402
1 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 7 1
      cnss2/main.c

+ 7 - 1
cnss2/main.c

@@ -407,9 +407,15 @@ int cnss_wlan_enable(struct device *dev,
 		     enum cnss_driver_mode mode,
 		     const char *host_version)
 {
-	struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(dev);
 	int ret = 0;
+	struct cnss_plat_data *plat_priv;
+
+	if (!dev) {
+		cnss_pr_err("Invalid dev pointer\n");
+		return -EINVAL;
+	}
 
+	plat_priv = cnss_bus_dev_to_plat_priv(dev);
 	if (!plat_priv)
 		return -ENODEV;