Message ID | 20240325230234.1847525-2-dave.jiang@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | cxl: access_coordinate validity fixes for 6.9 | expand |
Dave Jiang wrote: > The while() loop in cxl_endpoint_get_perf_coordinates() checks to see if > 'iter' is valid as part of the condition breaking out of the loop. However, > iter is being used before the check at the end of the while loop before > the next iteration starts. Given that the loop doesn't expect the iter to > be NULL because it stops before the root port, remove the iter check. This description can get much smaller by realizing that is_cxl_root() will always stop the loop before the next iteration could go NULL. I.e. > > The presence of the iter or removing the iter does not impact the behavior > of the code. This is a code clean up and not a bug fix. > > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Even though the changelog is not as concise as it could be, you can add: Reviewed-by: Dan Williams <dan.j.williams@intel.com>
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 2b0cab556072..6cbde50a742b 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -2197,7 +2197,7 @@ int cxl_endpoint_get_perf_coordinates(struct cxl_port *port, * port each iteration. If the parent is cxl root then there is * nothing to gather. */ - while (iter && !is_cxl_root(to_cxl_port(iter->dev.parent))) { + while (!is_cxl_root(to_cxl_port(iter->dev.parent))) { cxl_coordinates_combine(&c, &c, &dport->sw_coord); c.write_latency += dport->link_latency; c.read_latency += dport->link_latency;