]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ASoC: fsl-asoc-card: set priv->pdev before using it
authorElinor Montmasson <elinor.montmasson@savoirfairelinux.com>
Thu, 20 Jun 2024 13:25:03 +0000 (15:25 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 20 Jun 2024 15:11:19 +0000 (16:11 +0100)
commit90f3feb24172185f1832636264943e8b5e289245
tree8b708875fbe44b03be041374d77ae3c5726771c8
parent379bcd2c9197bf2c429434e8a01cea0ee1852316
ASoC: fsl-asoc-card: set priv->pdev before using it

priv->pdev pointer was set after being used in
fsl_asoc_card_audmux_init().
Move this assignment at the start of the probe function, so
sub-functions can correctly use pdev through priv.

fsl_asoc_card_audmux_init() dereferences priv->pdev to get access to the
dev struct, used with dev_err macros.
As priv is zero-initialised, there would be a NULL pointer dereference.
Note that if priv->dev is dereferenced before assignment but never used,
for example if there is no error to be printed, the driver won't crash
probably due to compiler optimisations.

Fixes: 708b4351f08c ("ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support")
Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
Link: https://patch.msgid.link/20240620132511.4291-2-elinor.montmasson@savoirfairelinux.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl-asoc-card.c