Message ID | 20230320145710.1120469-5-james.clark@arm.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | devres: Provide krealloc_array | expand |
On Mon, 20 Mar 2023 14:57:09 +0000 James Clark <james.clark@arm.com> wrote: > Now that devm_krealloc_array is available, add a comment justifying not > changing this occurrence to avoid any future auto fixups. > > Link: https://lore.kernel.org/all/20230318173402.20a4f60d@jic23-huawei/ > Signed-off-by: James Clark <james.clark@arm.com> LGTM Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > drivers/tty/serial/qcom_geni_serial.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c > index 28fbc927a546..8ae1fb7c2636 100644 > --- a/drivers/tty/serial/qcom_geni_serial.c > +++ b/drivers/tty/serial/qcom_geni_serial.c > @@ -1055,6 +1055,11 @@ static int setup_fifos(struct qcom_geni_serial_port *port) > (port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE; > > if (port->rx_buf && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) { > + /* > + * Use krealloc rather than krealloc_array because rx_buf is > + * accessed as 1 byte entries as well as 4 byte entries so it's > + * not necessarily an array. > + */ > port->rx_buf = devm_krealloc(uport->dev, port->rx_buf, > port->rx_fifo_depth * sizeof(u32), > GFP_KERNEL);
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 28fbc927a546..8ae1fb7c2636 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1055,6 +1055,11 @@ static int setup_fifos(struct qcom_geni_serial_port *port) (port->tx_fifo_depth * port->tx_fifo_width) / BITS_PER_BYTE; if (port->rx_buf && (old_rx_fifo_depth != port->rx_fifo_depth) && port->rx_fifo_depth) { + /* + * Use krealloc rather than krealloc_array because rx_buf is + * accessed as 1 byte entries as well as 4 byte entries so it's + * not necessarily an array. + */ port->rx_buf = devm_krealloc(uport->dev, port->rx_buf, port->rx_fifo_depth * sizeof(u32), GFP_KERNEL);
Now that devm_krealloc_array is available, add a comment justifying not changing this occurrence to avoid any future auto fixups. Link: https://lore.kernel.org/all/20230318173402.20a4f60d@jic23-huawei/ Signed-off-by: James Clark <james.clark@arm.com> --- drivers/tty/serial/qcom_geni_serial.c | 5 +++++ 1 file changed, 5 insertions(+)