LF-15138-2 nvmem: imx-ocotp-fsb-s400: fix the bug caused by not getting the se-fw2 device

When not getting the se-fw2 device, calling read_common_fuse() or
ele_write_fuse() will result in segmentation fault because fuse->se_dev
is a NULL pointer. Check fuse->se_dev to avoid this error.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
This commit is contained in:
Alice Guo 2025-05-09 10:43:13 +08:00 committed by Jason Liu
parent 41adc16f98
commit f7e7a3f151

View File

@ -395,6 +395,11 @@ static int imx_fsb_s400_fuse_probe(struct platform_device *pdev)
}
fuse->se_dev = get_se_dev(fuse->hw->se_pdev_name);
if (IS_ERR_OR_NULL(fuse->se_dev)) {
dev_err(&pdev->dev, "failed to get the se-fw2 device\n");
return -EPROBE_DEFER;
}
dev_dbg(&pdev->dev, "fuse nvmem device registered successfully\n");
return 0;