Re: [PATCH 1/2] gpio: realtek: Add GPIO support for RTD SoC variants

From: Krzysztof Kozlowski
Date: Thu Nov 02 2023 - 03:12:06 EST


On 02/11/2023 04:30, TY_Chang[張子逸] wrote:
> Hi Krzysztof,
>
>> On 01/11/2023 03:58, Tzuyi Chang wrote:
>>> This commit adds GPIO support for Realtek DHC RTD SoCs.
>>
>> Please do not use "This commit/patch", but imperative mood. See longer
>> explanation here:
>> https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-
>> patches.rst#L95
>>
>
> I will remove these words.
>
>>> +static int rtd_gpio_probe(struct platform_device *pdev) {
>>> + struct rtd_gpio *data;
>>> + const struct of_device_id *match;
>>> + struct device_node *node;
>>> + int ret;
>>> + int i;
>>> +
>>> + node = pdev->dev.of_node;
>>> + match = of_match_node(rtd_gpio_of_matches, pdev->dev.of_node);
>>> + if (!match || !match->data)
>>> + return -EINVAL;
>>> +
>>> + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
>>> + if (!data)
>>> + return -ENOMEM;
>>> +
>>> + data->assert_irq = irq_of_parse_and_map(node, 0);
>>> + if (!data->assert_irq)
>>> + goto deferred;
>>> +
>>> + data->deassert_irq = irq_of_parse_and_map(node, 1);
>>> + if (!data->deassert_irq)
>>> + goto deferred;
>>
>> So this goes to cleanup path...
>>
>
> Since there is no need to do devm_free, I will directly return -EPROBE_DEFER here.

That's not a correct return value. You do not return DEFER on missing
IRQ. This should anyway be different call: platform_get_irq().


Best regards,
Krzysztof