Re: [PATCH v4 14/14] cxl/region: Remove local variable @inc in cxl_port_setup_targets()

Jonathan Cameron
2025-11-11T15:36:48Z

On Mon, 3 Nov 2025 19:47:55 +0100
Robert Richter <rrichter@amd.com> wrote:

> Simplify the code by removing local variable @inc. The variable is not
> used elsewhere, remove it and directly increment the target number.
>
> Signed-off-by: Robert Richter <rrichter@amd.com>
Hmm. I wonder what the thought process behind this once was? Ah well
clearly not needed now and I can't be bothered to do the archeology /
have too much other stuff to review!

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> ---
> drivers/cxl/core/region.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index dec003084521..a81fbe9cedae 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -1332,7 +1332,7 @@ static int cxl_port_setup_targets(struct cxl_port *port,
> struct cxl_endpoint_decoder *cxled)
> {
> struct cxl_root_decoder *cxlrd = cxlr->cxlrd;
> - int parent_iw, parent_ig, ig, iw, rc, inc = 0, pos = cxled->pos;
> + int parent_iw, parent_ig, ig, iw, rc, pos = cxled->pos;
> struct cxl_port *parent_port = to_cxl_port(port->dev.parent);
> struct cxl_region_ref *cxl_rr = cxl_rr_load(port, cxlr);
> struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
> @@ -1524,9 +1524,8 @@ static int cxl_port_setup_targets(struct cxl_port *port,
> cxlsd->target[cxl_rr->nr_targets_set] = ep->dport;
> cxlsd->cxld.target_map[cxl_rr->nr_targets_set] = ep->dport->port_id;
> }
> - inc = 1;
> + cxl_rr->nr_targets_set++;
> out_target_set:
> - cxl_rr->nr_targets_set += inc;
> dev_dbg(&cxlr->dev, "%s:%s target[%d] = %s for %s:%s @ %d\n",
> dev_name(port->uport_dev), dev_name(&port->dev),
> cxl_rr->nr_targets_set - 1, dev_name(ep->dport->dport_dev),