Early exits from for_each_available_child_of_node() should decrement the
node reference counter. Reported by Coccinelle:
drivers/memory/stm32-fmc2-ebi.c:1046:1-33: WARNING:
Function "for_each_available_child_of_node" should have of_node_put() before return around line 1051.
Fixes:
66b8173a197f ("memory: stm32-fmc2-ebi: add STM32 FMC2 EBI controller driver")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Christophe Kerello <christophe.kerello@foss.st.com>
Link: https://lore.kernel.org/r/20210423101815.119341-1-krzysztof.kozlowski@canonical.com
if (ret) {
dev_err(dev, "could not retrieve reg property: %d\n",
ret);
+ of_node_put(child);
return ret;
}
if (bank >= FMC2_MAX_BANKS) {
dev_err(dev, "invalid reg value: %d\n", bank);
+ of_node_put(child);
return -EINVAL;
}
if (ebi->bank_assigned & BIT(bank)) {
dev_err(dev, "bank already assigned: %d\n", bank);
+ of_node_put(child);
return -EINVAL;
}
if (ret) {
dev_err(dev, "setup chip select %d failed: %d\n",
bank, ret);
+ of_node_put(child);
return ret;
}
}