Skip to content

Commit 414f65d

Browse files
jannaulag-linaro
authored andcommitted
mfd: macsmc: Initialize mutex
Initialize struct apple_smc's mutex in apple_smc_probe(). Using the mutex uninitialized surprisingly resulted only in occasional NULL pointer dereferences in apple_smc_read() calls from the probe() functions of sub devices. Cc: stable@vger.kernel.org Fixes: e038d98 ("mfd: Add Apple Silicon System Management Controller") Signed-off-by: Janne Grunau <j@jannau.net> Reviewed-by: Sven Peter <sven@kernel.org> Reviewed-by: Neal Gompa <neal@gompa.dev> Link: https://patch.msgid.link/20251231-macsmc-mutex_init-v2-1-5818c9dc9b29@jannau.net Signed-off-by: Lee Jones <lee@kernel.org>
1 parent e46de99 commit 414f65d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/mfd/macsmc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ static int apple_smc_probe(struct platform_device *pdev)
416416
if (!smc)
417417
return -ENOMEM;
418418

419+
mutex_init(&smc->mutex);
419420
smc->dev = &pdev->dev;
420421
smc->sram_base = devm_platform_get_and_ioremap_resource(pdev, 1, &smc->sram);
421422
if (IS_ERR(smc->sram_base))

0 commit comments

Comments
 (0)