Messages in this thread | ![/](/images/icornerl.gif) | | Subject | Re: [PATCH net-next 1/5] net: ravb: Get rid of the temporary variable irq | From | Sergey Shtylyov <> | Date | Fri, 9 Feb 2024 22:43:15 +0300 |
| |
On 2/9/24 8:48 AM, claudiu beznea wrote:
[...]
>>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>> >>> The 4th argument of ravb_setup_irq() is used to save the IRQ number that >>> will be further used by the driver code. Not all ravb_setup_irqs() calls >>> need to save the IRQ number. The previous code used to pass a dummy >>> variable as the 4th argument in case the IRQ is not needed for further >>> usage. That is not necessary as the code from ravb_setup_irq() can detect >>> by itself if the IRQ needs to be saved. Thus, get rid of the code that is >>> not needed. >>> >>> Reported-by: Sergey Shtylyov <s.shtylyov@omp.ru> >>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >> [...] >> >>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c >>> index 9521cd054274..e235342e0827 100644 >>> --- a/drivers/net/ethernet/renesas/ravb_main.c >>> +++ b/drivers/net/ethernet/renesas/ravb_main.c >>> @@ -2611,17 +2611,20 @@ static int ravb_setup_irq(struct ravb_private *priv, const char *irq_name, >>> if (!dev_name) >>> return -ENOMEM; >>> >>> - *irq = platform_get_irq_byname(pdev, irq_name); >>> + error = platform_get_irq_byname(pdev, irq_name); >>> flags = 0; >>> } else { >>> dev_name = ndev->name; >>> - *irq = platform_get_irq(pdev, 0); >>> + error = platform_get_irq(pdev, 0); >>> flags = IRQF_SHARED; >>> } >>> - if (*irq < 0) >>> - return *irq; >>> + if (error < 0) >>> + return error; >>> >>> - error = devm_request_irq(dev, *irq, handler, flags, dev_name, ndev); >>> + if (irq) >>> + *irq = error; >>> + >>> + error = devm_request_irq(dev, error, handler, flags, dev_name, ndev); >>> if (error) >>> netdev_err(ndev, "cannot request IRQ %s\n", dev_name); >>> >> >> Thanks for addressing my IRC comment! Tho the naming seems awful. :-)
if (error < 0) return error; if (irq) *irq = error;
error = devm_request_irq(dev, error, handler, flags, dev_name, ndev);
These just don't look right...
>> I'd suggest to add a local variable (named e.g, irq_num) and use it to > > I tried to avoid that...
Why? :-)
>> store the result of platform_get_irq[_byname](). >> >> [...]
MBR, Sergey
| ![\](/images/icornerr.gif) |