Re: [PATCH 5/6] can: flexcan: add CAN wakeup function for i.MX8QM

From: Marc Kleine-Budde
Date: Fri Oct 16 2020 - 03:45:00 EST


On 10/16/20 8:46 AM, Joakim Zhang wrote:
>>> @@ -2019,6 +2109,7 @@ static int flexcan_probe(struct platform_device
>> *pdev)
>>> priv->clk_src = clk_src;
>>> priv->devtype_data = devtype_data;
>>> priv->reg_xceiver = reg_xceiver;
>>> + priv->can_idx = can_idx;
>>>
>>> if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_FD) {
>>> priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD | @@
>> -2030,6
>>> +2121,10 @@ static int flexcan_probe(struct platform_device *pdev)
>>> priv->can.bittiming_const = &flexcan_bittiming_const;
>>> }
>>>
>>> + err = flexcan_setup_stop_mode(pdev);
>>> + if (err == -EPROBE_DEFER)
>>> + return -EPROBE_DEFER;
>>
>> You need to free "dev". What about moving this directly before allocating dev.
>
> Yes, need free "dev" here if defer probe. Flexcan_priv has not allocated
> before allocating dev, but we need initialize and check it when setup stop
> mode.

Right, please take care of freeing all ressouces in case of defered probe.

>> Do you have to undo device_set_wakeup_capable() and
>> device_set_wakeup_enable() in case of a failure and/or on flexcan_remove()?
>
> Yes, should invoke device_wakeup_disable() in flexcan_remove.

Make it so.

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

Attachment: signature.asc
Description: OpenPGP digital signature