Skip to content

Commit 336ac58

Browse files
committed
mfd: macsmc: Initialize mutex
Struct apple_smc's mutex was not initialized before use. Surprisingly this only resulted in occasional NULL pointer dereferences in apple_smc_read() calls from the probe() functions of sub devices. Fixes: e038d98 ("mfd: Add Apple Silicon System Management Controller") Signed-off-by: Janne Grunau <j@jannau.net>
1 parent b1ee949 commit 336ac58

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
@@ -413,6 +413,7 @@ static int apple_smc_probe(struct platform_device *pdev)
413413
if (!smc)
414414
return -ENOMEM;
415415

416+
mutex_init(&smc->mutex);
416417
smc->dev = &pdev->dev;
417418
smc->sram_base = devm_platform_get_and_ioremap_resource(pdev, 1, &smc->sram);
418419
if (IS_ERR(smc->sram_base))

0 commit comments

Comments
 (0)