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

Commit c025747a authored by Yue Ma's avatar Yue Ma
Browse files

cnss2: Add subsys check when do powerup and powerdown



Currently subsystem register will happen in PCIe enumeration callback.
There are cases that the callback will never be called from PCIe
framework. Add NULL checks for dev from subsys_desc when do powerup
and powerdown to avoid unnecessary crashes.

Change-Id: Ie0df098047f39753d6f904dfcb67be03d18bd56c
Signed-off-by: default avatarYue Ma <yuem@codeaurora.org>
parent c97f5cfd
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -1182,8 +1182,14 @@ static void cnss_qca6290_crash_shutdown(struct cnss_plat_data *plat_priv)
static int cnss_powerup(const struct subsys_desc *subsys_desc)
{
	int ret = 0;
	struct cnss_plat_data *plat_priv = dev_get_drvdata(subsys_desc->dev);
	struct cnss_plat_data *plat_priv;

	if (!subsys_desc->dev) {
		cnss_pr_err("dev from subsys_desc is NULL\n");
		return -ENODEV;
	}

	plat_priv = dev_get_drvdata(subsys_desc->dev);
	if (!plat_priv) {
		cnss_pr_err("plat_priv is NULL!\n");
		return -ENODEV;
@@ -1214,8 +1220,14 @@ static int cnss_powerup(const struct subsys_desc *subsys_desc)
static int cnss_shutdown(const struct subsys_desc *subsys_desc, bool force_stop)
{
	int ret = 0;
	struct cnss_plat_data *plat_priv = dev_get_drvdata(subsys_desc->dev);
	struct cnss_plat_data *plat_priv;

	if (!subsys_desc->dev) {
		cnss_pr_err("dev from subsys_desc is NULL\n");
		return -ENODEV;
	}

	plat_priv = dev_get_drvdata(subsys_desc->dev);
	if (!plat_priv) {
		cnss_pr_err("plat_priv is NULL!\n");
		return -ENODEV;