Re: [PATCH -next] serial: imx: remove set but not used variable 'rtsirq'

From: Leonard Crestez
Date: Thu Sep 20 2018 - 04:50:51 EST


On Thu, 2018-09-20 at 08:45 +0200, Jiri Slaby wrote:
> On 09/20/2018, 03:58 AM, YueHaibing wrote:
> > Fixes gcc '-Wunused-but-set-variable' warning:
> >
> > drivers/tty/serial/imx.c: In function 'imx_uart_probe':
> > drivers/tty/serial/imx.c:2198:20: warning:
> > variable 'rtsirq' set but not used [-Wunused-but-set-variable]
> >
> > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> > @@ -2220,7 +2220,6 @@ static int imx_uart_probe(struct platform_device *pdev)
> >
> > rxirq = platform_get_irq(pdev, 0);
> > txirq = platform_get_irq(pdev, 1);
> > - rtsirq = platform_get_irq(pdev, 2);
>
> I am not sure this is correct. platform_get_irq has side effects (like
> enabling the IRQ). Are you sure this won't change the behaviour (this is
> question mostly to IMX fellows)?

As far as I can tell there was a request_irq call for rtsirq which was
removed by mistake in commit afe9cbb1a6ad ("serial: imx: drop support
for IRDA"):

- /* do not use RTS IRQ on IrDA */
- if (!USE_IRDA(sport)) {
- ret = devm_request_irq(&pdev->dev, rtsirq,
- imx_rtsint, 0,
- dev_name(&pdev->dev), sport);
- if (ret)
- return ret;
- }

This should have just removed the IRDA check and request rtsirq
unconditionally. Nobody noticed this by testing RTS on imx1, this is an
old chip and later variants have a single combined irq.

The correct fix for the warning would be to restore that request_irq.

--
Regards,
Leonard