sdm660_cdc: Fix NULL pointer dereference in digital suspend

If soundcard registration has failed because of custom
driver probe failure and at the same time
msm_dig_suspend is called, this will lead to
null pointer dereference when component is accessed.
Add NULL check to avoid this.

CRs-Fixed: 2263093
Change-Id: I2d321814a316d9b3af1ff0f8963f2999520e60d2
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
This commit is contained in:
Vatsal Bucha 2018-06-19 12:06:52 +05:30
parent 1cbd1cdf84
commit 1ae05057ff

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, 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
@ -2136,6 +2136,10 @@ static int msm_dig_suspend(struct device *dev)
pr_debug("%s:digcodec not initialized, return\n", __func__);
return 0;
}
if (!registered_digcodec->component.card) {
pr_debug("%s:component not initialized, return\n", __func__);
return 0;
}
pdata = snd_soc_card_get_drvdata(registered_digcodec->component.card);
if (!pdata) {
pr_debug("%s:card not initialized, return\n", __func__);