Skip to content

Commit 93a32fc

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 <[email protected]>
1 parent ce8c3d1 commit 93a32fc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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)