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: I8ab93a71219638e4b66d3b9fdcb164e052385129
CRs-Fixed: 3364740
This commit is contained in:
Sai Kumar Kunchala
2022-12-20 14:23:22 +05:30
committed by Madan Koyyalamudi
parent 1def1b7402
commit b1788474b3

View File

@@ -449,9 +449,15 @@ EXPORT_SYMBOL(cnss_wlan_enable);
int cnss_wlan_disable(struct device *dev, enum cnss_driver_mode mode) int cnss_wlan_disable(struct device *dev, enum cnss_driver_mode mode)
{ {
struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(dev);
int ret = 0; 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) if (!plat_priv)
return -ENODEV; return -ENODEV;
@@ -574,8 +580,14 @@ EXPORT_SYMBOL(cnss_athdiag_write);
int cnss_set_fw_log_mode(struct device *dev, u8 fw_log_mode) int cnss_set_fw_log_mode(struct device *dev, u8 fw_log_mode)
{ {
struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(dev); 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) if (!plat_priv)
return -ENODEV; return -ENODEV;