Re: [PATCH] staging: vchiq_arm: Fix missing refcount decrement in error path for fw_node

From: Krzysztof Kozlowski
Date: Mon Oct 14 2024 - 04:52:01 EST


On 14/10/2024 09:22, Dan Carpenter wrote:
>> @@ -1341,8 +1342,6 @@ static int vchiq_probe(struct platform_device *pdev)
>> if (!info)
>> return -EINVAL;
>>
>> - fw_node = of_find_compatible_node(NULL, NULL,
>> - "raspberrypi,bcm2835-firmware");
>
> Perhaps it's better to declare the variable here so that the function and the
> error handling are next to each other.
>
> if (!info)
> return -EINVAL;
>
> struct device_node *fw_node __free(device_node) =
> of_find_compatible_node(NULL, NULL, "raspberrypi,bcm2835-firmware");
> if (!fw_node) {
>
> ...
>
> This is why we lifted the rule that variables had to be declared at the start
> of a function.
>


Ack, this is how this should look like.

Best regards,
Krzysztof