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: Sudheer Papothi <spapothi@codeaurora.org>
This commit is contained in:
Sudheer Papothi 2016-02-03 01:35:14 +05:30 committed by David Keitel
parent 6880b76660
commit db36660f6c

View file

@ -1,4 +1,4 @@
/* 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;