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

Commit 6d18b4d1 authored by Sudheer Papothi's avatar Sudheer Papothi
Browse files

soundwire: Fix NULL pointer check while setting group ID



Fix NULL pointer check while setting group ID to avoid
dereferening of the pointer.

CRs-Fixed: 971240
Change-Id: Ic5aae901244e7b2b96a894d265a6cc5c119f0367
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
parent ef78af1b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -618,11 +618,13 @@ EXPORT_SYMBOL(swr_reset_device);
 */
int swr_set_device_group(struct swr_device *swr_dev, u8 id)
{
	struct swr_master *master = swr_dev->master;
	struct swr_master *master;

	if (!swr_dev)
		return -EINVAL;

	swr_dev->group_id = id;
	master = swr_dev->master;
	if (!id && master)
		master->gr_sid = 0;