* [bug report] serial: qcom-geni: Enable support for half-duplex mode
@ 2025-08-01 13:07 Dan Carpenter
2025-08-06 8:57 ` Anup Kulkarni (IOT_SW)
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-08-01 13:07 UTC (permalink / raw)
To: Anup Kulkarni; +Cc: linux-serial
Hello Anup Kulkarni,
Commit 4fcc287f3c69 ("serial: qcom-geni: Enable support for
half-duplex mode") from Jun 3, 2025 (linux-next), leads to the
following Smatch static checker warning:
drivers/tty/serial/qcom_geni_serial.c:1952 qcom_geni_serial_probe()
warn: missing unwind goto?
drivers/tty/serial/qcom_geni_serial.c
1844 static int qcom_geni_serial_probe(struct platform_device *pdev)
1845 {
1846 int ret = 0;
1847 int line;
1848 struct qcom_geni_serial_port *port;
1849 struct uart_port *uport;
1850 struct resource *res;
1851 int irq;
1852 struct uart_driver *drv;
1853 const struct qcom_geni_device_data *data;
1854
1855 data = of_device_get_match_data(&pdev->dev);
1856 if (!data)
1857 return -EINVAL;
1858
1859 if (data->console) {
1860 drv = &qcom_geni_console_driver;
1861 line = of_alias_get_id(pdev->dev.of_node, "serial");
1862 } else {
1863 drv = &qcom_geni_uart_driver;
1864 line = of_alias_get_id(pdev->dev.of_node, "serial");
1865 if (line == -ENODEV) /* compat with non-standard aliases */
1866 line = of_alias_get_id(pdev->dev.of_node, "hsuart");
1867 }
1868
1869 port = get_port_from_line(line, data->console);
1870 if (IS_ERR(port)) {
1871 dev_err(&pdev->dev, "Invalid line %d\n", line);
1872 return PTR_ERR(port);
1873 }
1874
1875 uport = &port->uport;
1876 /* Don't allow 2 drivers to access the same port */
1877 if (uport->private_data)
1878 return -ENODEV;
1879
1880 uport->dev = &pdev->dev;
1881 port->dev_data = data;
1882 port->se.dev = &pdev->dev;
1883 port->se.wrapper = dev_get_drvdata(pdev->dev.parent);
1884
1885 ret = port->dev_data->resources_init(uport);
1886 if (ret)
1887 return ret;
1888
1889 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1890 if (!res) {
1891 ret = -EINVAL;
1892 goto error;
1893 }
1894
1895 uport->mapbase = res->start;
1896
1897 uport->rs485_config = qcom_geni_rs485_config;
1898 uport->rs485_supported = qcom_geni_rs485_supported;
1899 port->tx_fifo_depth = DEF_FIFO_DEPTH_WORDS;
1900 port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS;
1901 port->tx_fifo_width = DEF_FIFO_WIDTH_BITS;
1902
1903 if (!data->console) {
1904 port->rx_buf = devm_kzalloc(uport->dev,
1905 DMA_RX_BUF_SIZE, GFP_KERNEL);
1906 if (!port->rx_buf) {
1907 ret = -ENOMEM;
1908 goto error;
1909 }
1910 }
1911
1912 port->name = devm_kasprintf(uport->dev, GFP_KERNEL,
1913 "qcom_geni_serial_%s%d",
1914 uart_console(uport) ? "console" : "uart", uport->line);
1915 if (!port->name) {
1916 ret = -ENOMEM;
1917 goto error;
1918 }
1919
1920 irq = platform_get_irq(pdev, 0);
1921 if (irq < 0) {
1922 ret = irq;
1923 goto error;
1924 }
1925
1926 uport->irq = irq;
1927 uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_QCOM_GENI_CONSOLE);
1928
1929 if (!data->console)
1930 port->wakeup_irq = platform_get_irq_optional(pdev, 1);
1931
1932 if (of_property_read_bool(pdev->dev.of_node, "rx-tx-swap"))
1933 port->rx_tx_swap = true;
1934
1935 if (of_property_read_bool(pdev->dev.of_node, "cts-rts-swap"))
1936 port->cts_rts_swap = true;
1937
1938 port->private_data.drv = drv;
1939 uport->private_data = &port->private_data;
1940 platform_set_drvdata(pdev, port);
1941
1942 irq_set_status_flags(uport->irq, IRQ_NOAUTOEN);
1943 ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr,
1944 IRQF_TRIGGER_HIGH, port->name, uport);
1945 if (ret) {
1946 dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret);
1947 goto error;
1948 }
1949
1950 ret = uart_get_rs485_mode(uport);
1951 if (ret)
--> 1952 return ret;
goto error;
1953
1954 devm_pm_runtime_enable(port->se.dev);
1955
1956 ret = uart_add_one_port(drv, uport);
1957 if (ret)
1958 goto error;
1959
1960 if (port->wakeup_irq > 0) {
1961 device_init_wakeup(&pdev->dev, true);
1962 ret = dev_pm_set_dedicated_wake_irq(&pdev->dev,
1963 port->wakeup_irq);
1964 if (ret) {
1965 device_init_wakeup(&pdev->dev, false);
1966 ida_free(&port_ida, uport->line);
1967 uart_remove_one_port(drv, uport);
1968 goto error;
1969 }
1970 }
1971
1972 return 0;
1973
1974 error:
1975 dev_pm_domain_detach_list(port->pd_list);
1976 return ret;
1977 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [bug report] serial: qcom-geni: Enable support for half-duplex mode
2025-08-01 13:07 [bug report] serial: qcom-geni: Enable support for half-duplex mode Dan Carpenter
@ 2025-08-06 8:57 ` Anup Kulkarni (IOT_SW)
0 siblings, 0 replies; 2+ messages in thread
From: Anup Kulkarni (IOT_SW) @ 2025-08-06 8:57 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-serial@vger.kernel.org
Will update the change in a new patch.
Thanks and regards
Anup Kulkarni
-----Original Message-----
From: Dan Carpenter <dan.carpenter@linaro.org>
Sent: Friday, August 1, 2025 6:37 PM
To: Anup Kulkarni (QUIC) <quic_anupkulk@quicinc.com>
Cc: linux-serial@vger.kernel.org
Subject: [bug report] serial: qcom-geni: Enable support for half-duplex mode
WARNING: This email originated from outside of Qualcomm. Please be wary of any links or attachments, and do not enable macros.
Hello Anup Kulkarni,
Commit 4fcc287f3c69 ("serial: qcom-geni: Enable support for half-duplex mode") from Jun 3, 2025 (linux-next), leads to the following Smatch static checker warning:
drivers/tty/serial/qcom_geni_serial.c:1952 qcom_geni_serial_probe()
warn: missing unwind goto?
drivers/tty/serial/qcom_geni_serial.c
1844 static int qcom_geni_serial_probe(struct platform_device *pdev)
1845 {
1846 int ret = 0;
1847 int line;
1848 struct qcom_geni_serial_port *port;
1849 struct uart_port *uport;
1850 struct resource *res;
1851 int irq;
1852 struct uart_driver *drv;
1853 const struct qcom_geni_device_data *data;
1854
1855 data = of_device_get_match_data(&pdev->dev);
1856 if (!data)
1857 return -EINVAL;
1858
1859 if (data->console) {
1860 drv = &qcom_geni_console_driver;
1861 line = of_alias_get_id(pdev->dev.of_node, "serial");
1862 } else {
1863 drv = &qcom_geni_uart_driver;
1864 line = of_alias_get_id(pdev->dev.of_node, "serial");
1865 if (line == -ENODEV) /* compat with non-standard aliases */
1866 line = of_alias_get_id(pdev->dev.of_node, "hsuart");
1867 }
1868
1869 port = get_port_from_line(line, data->console);
1870 if (IS_ERR(port)) {
1871 dev_err(&pdev->dev, "Invalid line %d\n", line);
1872 return PTR_ERR(port);
1873 }
1874
1875 uport = &port->uport;
1876 /* Don't allow 2 drivers to access the same port */
1877 if (uport->private_data)
1878 return -ENODEV;
1879
1880 uport->dev = &pdev->dev;
1881 port->dev_data = data;
1882 port->se.dev = &pdev->dev;
1883 port->se.wrapper = dev_get_drvdata(pdev->dev.parent);
1884
1885 ret = port->dev_data->resources_init(uport);
1886 if (ret)
1887 return ret;
1888
1889 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1890 if (!res) {
1891 ret = -EINVAL;
1892 goto error;
1893 }
1894
1895 uport->mapbase = res->start;
1896
1897 uport->rs485_config = qcom_geni_rs485_config;
1898 uport->rs485_supported = qcom_geni_rs485_supported;
1899 port->tx_fifo_depth = DEF_FIFO_DEPTH_WORDS;
1900 port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS;
1901 port->tx_fifo_width = DEF_FIFO_WIDTH_BITS;
1902
1903 if (!data->console) {
1904 port->rx_buf = devm_kzalloc(uport->dev,
1905 DMA_RX_BUF_SIZE, GFP_KERNEL);
1906 if (!port->rx_buf) {
1907 ret = -ENOMEM;
1908 goto error;
1909 }
1910 }
1911
1912 port->name = devm_kasprintf(uport->dev, GFP_KERNEL,
1913 "qcom_geni_serial_%s%d",
1914 uart_console(uport) ? "console" : "uart", uport->line);
1915 if (!port->name) {
1916 ret = -ENOMEM;
1917 goto error;
1918 }
1919
1920 irq = platform_get_irq(pdev, 0);
1921 if (irq < 0) {
1922 ret = irq;
1923 goto error;
1924 }
1925
1926 uport->irq = irq;
1927 uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_QCOM_GENI_CONSOLE);
1928
1929 if (!data->console)
1930 port->wakeup_irq = platform_get_irq_optional(pdev, 1);
1931
1932 if (of_property_read_bool(pdev->dev.of_node, "rx-tx-swap"))
1933 port->rx_tx_swap = true;
1934
1935 if (of_property_read_bool(pdev->dev.of_node, "cts-rts-swap"))
1936 port->cts_rts_swap = true;
1937
1938 port->private_data.drv = drv;
1939 uport->private_data = &port->private_data;
1940 platform_set_drvdata(pdev, port);
1941
1942 irq_set_status_flags(uport->irq, IRQ_NOAUTOEN);
1943 ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr,
1944 IRQF_TRIGGER_HIGH, port->name, uport);
1945 if (ret) {
1946 dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret);
1947 goto error;
1948 }
1949
1950 ret = uart_get_rs485_mode(uport);
1951 if (ret)
--> 1952 return ret;
goto error;
1953
1954 devm_pm_runtime_enable(port->se.dev);
1955
1956 ret = uart_add_one_port(drv, uport);
1957 if (ret)
1958 goto error;
1959
1960 if (port->wakeup_irq > 0) {
1961 device_init_wakeup(&pdev->dev, true);
1962 ret = dev_pm_set_dedicated_wake_irq(&pdev->dev,
1963 port->wakeup_irq);
1964 if (ret) {
1965 device_init_wakeup(&pdev->dev, false);
1966 ida_free(&port_ida, uport->line);
1967 uart_remove_one_port(drv, uport);
1968 goto error;
1969 }
1970 }
1971
1972 return 0;
1973
1974 error:
1975 dev_pm_domain_detach_list(port->pd_list);
1976 return ret;
1977 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-06 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-01 13:07 [bug report] serial: qcom-geni: Enable support for half-duplex mode Dan Carpenter
2025-08-06 8:57 ` Anup Kulkarni (IOT_SW)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).