[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5ddaf113-c8f6-7c9c-5bf6-27f2f7855d24@collabora.com>
Date: Mon, 25 Apr 2022 22:25:40 +0300
From: Dmitry Osipenko <dmitry.osipenko@...labora.com>
To: Ashish Mhetre <amhetre@...dia.com>, krzysztof.kozlowski@...aro.org,
thierry.reding@...il.com, jonathanh@...dia.com, digetx@...il.com,
robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
devicetree@...r.kernel.org
Cc: vdumpa@...dia.com, Snikam@...dia.com
Subject: Re: [Patch v8 1/4] memory: tegra: Add memory controller channels
support
On 4/25/22 10:50, Ashish Mhetre wrote:
> +static int tegra186_mc_map_regs(struct tegra_mc *mc)
> +{
> + struct platform_device *pdev = to_platform_device(mc->dev);
> + int i;
> +
> + mc->bcast_ch_regs = devm_platform_ioremap_resource_byname(pdev, "broadcast");
> + if (IS_ERR(mc->bcast_ch_regs)) {
> + if (PTR_ERR(mc->bcast_ch_regs) == -EINVAL) {
> + dev_warn(&pdev->dev, "Broadcast channel is missing, please update your device-tree\n");
> + mc->bcast_ch_regs = NULL;
> + return 0;
> + }
> + return PTR_ERR(mc->bcast_ch_regs);
> + }
> +
> + mc->ch_regs = devm_kcalloc(mc->dev, mc->soc->num_channels,
> + sizeof(void __iomem *), GFP_KERNEL);
You should use sizeof(*mc->ch_regs) in general to prevent mistakes.
> + if (!mc->ch_regs)
> + return -ENOMEM;
> +
> + for (i = 0; i < mc->soc->num_channels; i++) {
> + char name[5];
> +
> + snprintf(name, sizeof(name), "ch%u", i);
The type of "i" variable is int, change it to unsigned int.
With that:
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@...labora.com>
Powered by blists - more mailing lists