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

Commit daa0f471 authored by Chris Lew's avatar Chris Lew
Browse files

net: neuron: channel: Move waitq init



Initialize the waitq before registering with the doorbell framework to
prevent uninitialized variable access.

Change-Id: Icb902b829a6af52716713b18891e4e35c0c2a620
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent 73db1046
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2020 The Linux Foundation. All rights reserved. */
/* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. */

#include <linux/init.h>
#include <linux/interrupt.h>
@@ -479,6 +479,7 @@ static int channel_hh_probe(struct neuron_channel *cdev)
	if (!priv)
		return -ENOMEM;
	priv->dev = cdev;
	init_waitqueue_head(&priv->wait_q);

	ret = of_property_read_u32(node, "haven-label", &priv->haven_label);
	if (ret) {
@@ -507,8 +508,6 @@ static int channel_hh_probe(struct neuron_channel *cdev)
		dev_err(dev, "failed to get haven rx dbl %d\n", ret);
		goto fail_rx_dbl;
	}

	init_waitqueue_head(&priv->wait_q);
	/* Start the thread for syncing with the sender. */
	priv->sync_thread = kthread_run(channel_sync_thread, priv,
					"recv_sync_thread");
+2 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2020 The Linux Foundation. All rights reserved. */
/* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. */

#include <linux/init.h>
#include <linux/interrupt.h>
@@ -464,6 +464,7 @@ static int channel_hh_probe(struct neuron_channel *cdev)
	if (!priv)
		return -ENOMEM;
	priv->dev = cdev;
	init_waitqueue_head(&priv->wait_q);

	ret = of_property_read_u32(node, "haven-label", &priv->haven_label);
	if (ret) {
@@ -490,8 +491,6 @@ static int channel_hh_probe(struct neuron_channel *cdev)
		dev_err(dev, "failed to get haven rx dbl %d\n", ret);
		goto fail_rx_dbl;
	}

	init_waitqueue_head(&priv->wait_q);
	/* Start the thread for syncing with the receiver. */
	priv->sync_thread = kthread_run(channel_sync_thread, priv,
					"send_sync_thread");