mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 10:11:26 +03:00
ASoC: tegra-alt: Check if pinctrl state is NULL
If the pinctrl node is not present in device-tree for the DMIC, DSPK or I2S, then the pinctrl states will not be initialised during device probe. This can cause the kernel to crash by attempting to dereference a NULL pointer when setting the pinctrl state. Fix this by verifying that the pinctrl state is not an error pointer or NULL before attempting to use it. Bug 1665446 Change-Id: I917141325f12bbf87371eb59a320fe08e65f0934 Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2120320 (cherry picked from commit f3aa620e26af45a6bafe5acb65f2b06df0b877e8) Reviewed-on: https://git-master.nvidia.com/r/2122730 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Sameer Pujar
parent
52f2d67cf4
commit
e34a9de325
@@ -187,7 +187,7 @@ static int tegra186_dspk_startup(struct snd_pcm_substream *substream,
|
||||
}
|
||||
|
||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
||||
if (!IS_ERR(dspk->pin_active_state)) {
|
||||
if (!IS_ERR_OR_NULL(dspk->pin_active_state)) {
|
||||
ret = pinctrl_select_state(dspk->pinctrl,
|
||||
dspk->pin_active_state);
|
||||
if (ret < 0) {
|
||||
@@ -209,7 +209,7 @@ static void tegra186_dspk_shutdown(struct snd_pcm_substream *substream,
|
||||
int ret;
|
||||
|
||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
||||
if (!IS_ERR(dspk->pin_idle_state)) {
|
||||
if (!IS_ERR_OR_NULL(dspk->pin_idle_state)) {
|
||||
ret = pinctrl_select_state(
|
||||
dspk->pinctrl, dspk->pin_idle_state);
|
||||
if (ret < 0) {
|
||||
|
||||
Reference in New Issue
Block a user