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

Commit 60aad997 authored by Sean Tranchetti's avatar Sean Tranchetti Committed by Gerrit - the friendly Code Review server
Browse files

drivers: soc: qcom: Statically initialize powersave list



Calling qmi_rmnet_ps_ind_register() too early can result in NULL pointer
dereferences because the list used to store the callback structs might
not have been initialized yet.

Instead of waiting to initialize the list until qmi_rmnet_change_link()
is called with an NLMSG_CLIENT_SETUP message from userspace, we can simply
statically initialize the list so modules can register their callback
structs immediately, and start receiving notifications once the proper
indications are sent from userspace.

Change-Id: Ib5b1df5a8f9c903592d557e6a1099ccb4402bac0
Signed-off-by: default avatarSean Tranchetti <stranche@codeaurora.org>
parent 931284c5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -738,7 +738,7 @@ EXPORT_SYMBOL(qmi_rmnet_qos_exit);
#ifdef CONFIG_QCOM_QMI_POWER_COLLAPSE
static struct workqueue_struct  *rmnet_ps_wq;
static struct rmnet_powersave_work *rmnet_work;
static struct list_head ps_list;
static LIST_HEAD(ps_list);

struct rmnet_powersave_work {
	struct delayed_work work;
@@ -934,7 +934,6 @@ void qmi_rmnet_work_init(void *port)
		rmnet_ps_wq = NULL;
		return;
	}
	INIT_LIST_HEAD(&ps_list);
	INIT_DEFERRABLE_WORK(&rmnet_work->work, qmi_rmnet_check_stats);
	rmnet_work->port = port;
	rmnet_get_packets(rmnet_work->port, &rmnet_work->old_rx_pkts,