Skip to content

Commit dda2dd2

Browse files
committed
power: reset: macsmc-reboot: Prevent probing without of_node
MFD will probe sub devices declared with MFD_CELL_OF() even without match on the device tree compatible. macsmc-reboot depends on nvmem provided via device tree. Fail probe() with -ENODEV if this information is missing. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 71f9f64 commit dda2dd2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/power/reset/macsmc-reboot.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,14 @@ static int macsmc_reboot_probe(struct platform_device *pdev)
205205
struct macsmc_reboot *reboot;
206206
int ret, i;
207207

208+
/*
209+
* MFD will probe this device even without a node in the device tree,
210+
* thus bail out early if the SMC on the current machines does not
211+
* support reboot and has no node in the device tree.
212+
*/
213+
if (!pdev->dev.of_node)
214+
return -ENODEV;
215+
208216
reboot = devm_kzalloc(&pdev->dev, sizeof(*reboot), GFP_KERNEL);
209217
if (!reboot)
210218
return -ENOMEM;

0 commit comments

Comments
 (0)