lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 6 Jul 2023 16:12:43 -0500
From: Judith Mendez <jm@...com>
To: Francesco Dolcini <francesco@...cini.it>
CC: Marc Kleine-Budde <mkl@...gutronix.de>,
        Chandrasekar Ramakrishnan
	<rcsekar@...sung.com>,
        Wolfgang Grandegger <wg@...ndegger.com>,
        "David S .
 Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>, Jakub
 Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, <linux-can@...r.kernel.org>,
        <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Schuyler Patton <spatton@...com>, Tero Kristo
	<kristo@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski
	<krzysztof.kozlowski+dt@...aro.org>,
        <devicetree@...r.kernel.org>,
        Oliver
 Hartkopp <socketcan@...tkopp.net>,
        Simon Horman <simon.horman@...igine.com>
Subject: Re: [PATCH 2/2] can: m_can: Add hrtimer to generate software
 interrupt

Hi,

On 7/6/23 3:21 PM, Francesco Dolcini wrote:
> On Thu, Jul 06, 2023 at 10:20:59AM -0500, Judith Mendez wrote:
>> Hi Marc
>>
>> On 7/6/23 2:25 AM, Marc Kleine-Budde wrote:
>>> On 05.07.2023 14:53:56, Judith Mendez wrote:
>>>> Introduce timer polling method to MCAN since some SoCs may not
>>>> have M_CAN interrupt routed to A53 Linux and do not have
>>>> interrupt property in device tree M_CAN node.
>>>>
>>>> On AM62x SoC, MCANs on MCU domain do not have hardware interrupt
>>>> routed to A53 Linux, instead they will use timer polling method.
>>>>
>>>> Add an hrtimer to MCAN class device. Each MCAN will have its own
>>>> hrtimer instantiated if there is no hardware interrupt found in
>>>> device tree M_CAN node. The timer will generate a software
>>>> interrupt every 1 ms. In hrtimer callback, we check if there is
>>>> a transaction pending by reading a register, then process by
>>>> calling the isr if there is.
>>>>
>>>> Tested-by: Hiago De Franco <hiago.franco@...adex.com> # Toradex Verdin AM62
>>>> Reviewed-by: Tony Lindgren <tony@...mide.com>
>>>> Signed-off-by: Judith Mendez <jm@...com>
>>>> ---
> 
> ...
> 
>>>> diff --git a/drivers/net/can/m_can/m_can_platform.c b/drivers/net/can/m_can/m_can_platform.c
>>>> index 94dc82644113..76d11ce38220 100644
>>>> --- a/drivers/net/can/m_can/m_can_platform.c
>>>> +++ b/drivers/net/can/m_can/m_can_platform.c
>>>> @@ -5,6 +5,7 @@
>>>>    //
>>>>    // Copyright (C) 2018-19 Texas Instruments Incorporated - http://www.ti.com/
>>>> +#include <linux/hrtimer.h>
>>>>    #include <linux/phy/phy.h>
>>>>    #include <linux/platform_device.h>
>>>> @@ -96,12 +97,28 @@ static int m_can_plat_probe(struct platform_device *pdev)
>>>>    		goto probe_fail;
>>>
>>> Please set "irq" to 0 during declaration.
>>
>> During declaration of irq, it is already set to 0:
>>
>> int irq, ret = 0;
> 
> The initialization here applies only to ret.
> 
> int irq = 0, ret = 0;

Understood, thanks!

> 
>>>>    	addr = devm_platform_ioremap_resource_byname(pdev, "m_can");
>>>> -	irq = platform_get_irq_byname(pdev, "int0");
>>>> -	if (IS_ERR(addr) || irq < 0) {
>>>> -		ret = -EINVAL;
>>>> +	if (IS_ERR(addr)) {
>>>> +		ret = PTR_ERR(addr);
>>>>    		goto probe_fail;
>>>>    	}
>>>> +	if (device_property_present(mcan_class->dev, "interrupts") ||
>>>> +	    device_property_present(mcan_class->dev, "interrupt-names")) {
>>>> +		irq = platform_get_irq_byname(pdev, "int0");
>>>> +		if (irq == -EPROBE_DEFER) {
>>>> +			ret = -EPROBE_DEFER;
>>>> +			goto probe_fail;
>>>> +		}
>>>> +		if (irq < 0) {
>>>> +			ret = -EINVAL;
>>>
>>> Please return the original error value.
>>
>> The original value returned is -EINVAL:
>>
>> -	if (IS_ERR(addr) || irq < 0) {
>> -		ret = -EINVAL;
>>
>> Perhaps I am missing something here?
> 
> if (irq < 0) {
> 	ret = irq;
> 	...
> }
> 
> And you can also get rid of the explicit test for -EPROBE_DEFER this
> way simplifying the code.

I misunderstood, thanks!!

~ Judith

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ