[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PAXPR04MB9185D2680B5738134243045589C2A@PAXPR04MB9185.eurprd04.prod.outlook.com>
Date: Thu, 6 Nov 2025 17:00:32 +0000
From: Shenwei Wang <shenwei.wang@....com>
To: Zhongqiu Han <zhongqiu.han@....qualcomm.com>, Bjorn Andersson
<andersson@...nel.org>, Mathieu Poirier <mathieu.poirier@...aro.org>, Rob
Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor
Dooley <conor+dt@...nel.org>, Shawn Guo <shawnguo@...nel.org>, Sascha Hauer
<s.hauer@...gutronix.de>, Jonathan Corbet <corbet@....net>, Linus Walleij
<linus.walleij@...aro.org>, Bartosz Golaszewski <brgl@...ev.pl>
CC: Pengutronix Kernel Team <kernel@...gutronix.de>, Fabio Estevam
<festevam@...il.com>, Peng Fan <peng.fan@....com>,
"linux-remoteproc@...r.kernel.org" <linux-remoteproc@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-doc@...r.kernel.org"
<linux-doc@...r.kernel.org>, dl-linux-imx <linux-imx@....com>, Andrew Lunn
<andrew@...n.ch>
Subject: Re: [PATCH v5 4/5] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
> -----Original Message-----
> From: Zhongqiu Han <zhongqiu.han@....qualcomm.com>
> Sent: Thursday, November 6, 2025 6:31 AM
> To: Shenwei Wang <shenwei.wang@....com>; Bjorn Andersson
> <andersson@...nel.org>; Mathieu Poirier <mathieu.poirier@...aro.org>; Rob
> Herring <robh@...nel.org>; Krzysztof Kozlowski <krzk+dt@...nel.org>; Conor
> Dooley <conor+dt@...nel.org>; Shawn Guo <shawnguo@...nel.org>; Sascha
> Hauer <s.hauer@...gutronix.de>; Jonathan Corbet <corbet@....net>; Linus
> Walleij <linus.walleij@...aro.org>; Bartosz Golaszewski <brgl@...ev.pl>
> Cc: Pengutronix Kernel Team <kernel@...gutronix.de>; Fabio Estevam
> <festevam@...il.com>; Peng Fan <peng.fan@....com>; linux-
> remoteproc@...r.kernel.org; devicetree@...r.kernel.org; imx@...ts.linux.dev;
> linux-arm-kernel@...ts.infradead.org; linux-kernel@...r.kernel.org; linux-
> doc@...r.kernel.org; dl-linux-imx <linux-imx@....com>; Andrew Lunn
> <andrew@...n.ch>; zhongqiu.han@....qualcomm.com
> Subject: [EXT] Re: [PATCH v5 4/5] gpio: imx-rpmsg: add imx-rpmsg GPIO driver
> On 11/5/2025 4:33 AM, Shenwei Wang wrote:
> > On i.MX SoCs, the system may include two processors:
> > - An MCU running an RTOS
> > - An MPU running Linux
> >
> > +
> > +struct imx_rpmsg_gpio_port {
> > + struct gpio_chip gc;
> > + struct imx_rpmsg_gpio_pin gpio_pins[IMX_RPMSG_GPIO_PER_PORT];
> > + struct imx_gpio_rpmsg_info info;
> > + int idx;
> > +};
> > +
>
> Hello Shenwei,
> I'd like to go over a few aspects of this patch.
>
Hi Zhongqiu,
Thank you for the review. I'll address the two issues you reported below in the next revision.
Thanks,
Shenwei
>
> > +static int gpio_send_message(struct imx_rpmsg_gpio_port *port,
> > + struct gpio_rpmsg_data *msg,
> > + bool sync)
> > +{
> > + struct imx_gpio_rpmsg_info *info = &port->info;
> > + int err;
> > +
> > + if (!info->rpdev) {
> > + dev_dbg(&info->rpdev->dev,
>
> 1.NULL pointer dereference here.
>
> > + "rpmsg channel doesn't exist, is remote core ready?\n");
> > + return -EINVAL;
> > + }
> > +
> > + reinit_completion(&info->cmd_complete);
> > + err = rpmsg_send(info->rpdev->ept, (void *)msg,
> > + sizeof(struct gpio_rpmsg_data));
> > +static void imx_rpmsg_irq_bus_sync_unlock(struct irq_data *d) {
> > + struct imx_rpmsg_gpio_port *port = irq_data_get_irq_chip_data(d);
> > + struct gpio_rpmsg_data *msg = NULL;
> > + u32 gpio_idx = d->hwirq;
> > +
> > + if (port == NULL) {
> > + mutex_unlock(&port->info.lock);
> > + return;
> > + }
> > +
>
> 2.Unlocking port->info.lock when port is NULL will crash due to a NULL
> pointer dereference. Please fix the logic as well.> + /*
> > + * For mask irq, do nothing here.
> > + * M core will mask interrupt after a interrupt occurred, and then
> > + * sends a notify to A core.
> > + * After A core dealt with the notify, A core will send a rpmsg to
> > + * M core to unmask this interrupt again.
> > + */
> > +
> > + if (port->gpio_pins[gpio_idx].irq_mask && !port-
> >gpio_pins[gpio_idx].irq_unmask) {
> > + port->gpio_pins[gpio_idx].irq_mask = 0;
> > + mutex_unlock(&port->info.lock);
> > + return;
> > + }
> > +
> > +
> > +MODULE_AUTHOR("Shenwei Wang <shenwei.wang@....com>");
> > +MODULE_DESCRIPTION("NXP i.MX SoC rpmsg gpio driver");
> > +MODULE_LICENSE("GPL");
> > --
> > 2.43.0
> >
> >
>
>
> --
> Thx and BRs,
> Zhongqiu Han
Powered by blists - more mailing lists