[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <504216f8-34f6-11a0-d98e-84ff3901ed52@linaro.org>
Date: Mon, 15 Jun 2020 10:39:21 +0100
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To: Chunyan Zhang <zhang.lyra@...il.com>
Cc: linux-kernel@...r.kernel.org, Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang7@...il.com>,
Chunyan Zhang <chunyan.zhang@...soc.com>,
Freeman Liu <freeman.liu@...soc.com>
Subject: Re: [PATCH] nvmem: sc27xx: add sc2730 efuse support
On 15/06/2020 04:23, Chunyan Zhang wrote:
> From: Freeman Liu <freeman.liu@...soc.com>
>
> 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 <freeman.liu@...soc.com>
> Signed-off-by: Chunyan Zhang <chunyan.zhang@...soc.com>
> ---
> 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;
>
Powered by blists - more mailing lists