On 4/26/2022 12:55 AM, Dmitry Osipenko wrote:
External email: Use caution opening links or attachments
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.
Okay, I will update this in v9.
+ 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.
Okay, I will update in next version.
With that:
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@xxxxxxxxxxxxx>
Thanks Dmitry.