On 15/06/2020 04:23, Chunyan Zhang wrote:
From: Freeman Liu <[email protected]> Add support to the new efuse IP which is integrated in the SC2730 which includes multiple blocks in a single chip. Signed-off-by: Freeman Liu <[email protected]> Signed-off-by: Chunyan Zhang <[email protected]> --- drivers/nvmem/sc27xx-efuse.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/nvmem/sc27xx-efuse.c b/drivers/nvmem/sc27xx-efuse.c index ab5e7e0bc3d8..7d453c9d80da 100644 --- a/drivers/nvmem/sc27xx-efuse.c +++ b/drivers/nvmem/sc27xx-efuse.c
...
@@ -187,8 +206,15 @@ static int sc27xx_efuse_probe(struct platform_device *pdev)struct nvmem_config econfig = { }; struct nvmem_device *nvmem; struct sc27xx_efuse *efuse; + const struct sc27xx_efuse_variant_data *pdata; int ret;+ pdata = of_device_get_match_data(&pdev->dev);+ if (!pdata) {
This check is totally unnecessary as you would not end up here unless there is a matching compatible!
You could move this after kmalloc and assign efuse->var_data directly!! --srini
+ dev_err(&pdev->dev, "No matching driver data found\n"); + return -EINVAL; + } + efuse = devm_kzalloc(&pdev->dev, sizeof(*efuse), GFP_KERNEL); if (!efuse) return -ENOMEM; @@ -219,6 +245,7 @@ static int sc27xx_efuse_probe(struct platform_device *pdev)mutex_init(&efuse->mutex);efuse->dev = &pdev->dev; + efuse->var_data = pdata;

