Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 215bb425 authored by Ke Huang's avatar Ke Huang Committed by Kuichu Ni
Browse files

cnss2: add null pointer check



The return value of the function cnss_bus_dev_to_plat_priv() has a
chance to NULL, So we have to check "plat_priv" if it is a null
pointer before it is dereferenced.

Change-Id: I8a5bbe5037d1f15113e58bb16b90f243ea8ef807
Signed-off-by: default avatarKe Huang <keh@codeaurora.org>
Signed-off-by: default avatarKuichu Ni <kuichun@codeaurora.org>
parent 32339e54
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -284,6 +284,9 @@ int cnss_wlan_enable(struct device *dev,
	struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(dev);
	int ret = 0;

	if (!plat_priv)
		return -ENODEV;

	if (plat_priv->device_id == QCA6174_DEVICE_ID)
		return 0;

@@ -320,6 +323,9 @@ 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;

	if (!plat_priv)
		return -ENODEV;

	if (plat_priv->device_id == QCA6174_DEVICE_ID)
		return 0;

@@ -395,6 +401,9 @@ 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);

	if (!plat_priv)
		return -ENODEV;

	if (plat_priv->device_id == QCA6174_DEVICE_ID)
		return 0;