On Tue, Apr 23, 2024 at 9:32 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote: > > Hello Rob Herring, > > Commit 37fa4905d22a ("dmaengine: qcom_hidma: simplify DT resource > parsing") from Jan 4, 2018 (linux-next), leads to the following > Smatch static checker warning: > > drivers/dma/qcom/hidma_mgmt.c:408 hidma_mgmt_of_populate_channels() > warn: both zero and negative are errors 'ret' > > drivers/dma/qcom/hidma_mgmt.c > 348 static int __init hidma_mgmt_of_populate_channels(struct device_node *np) > 349 { > 350 struct platform_device *pdev_parent = of_find_device_by_node(np); > 351 struct platform_device_info pdevinfo; > 352 struct device_node *child; > 353 struct resource *res; > 354 int ret = 0; > 355 > 356 /* allocate a resource array */ > 357 res = kcalloc(3, sizeof(*res), GFP_KERNEL); > 358 if (!res) > 359 return -ENOMEM; > 360 > 361 for_each_available_child_of_node(np, child) { > 362 struct platform_device *new_pdev; > 363 > 364 ret = of_address_to_resource(child, 0, &res[0]); > 365 if (!ret) > 366 goto out; > > This if statement seems reversed. It will exit with success on the > first iteration through the loop. Indeed! Obviously no one is using DT with this driver as it has been broken since 2018. It's for a server platform as well, and DT usage is rare to begin with on them (excluding all of IBM Power of course). So I'll send patches removing DT support in this driver and the associated binding. Rob