RE: [PATCH v2 04/12] cxl: Unify debug messages when calling devm_cxl_add_dport()
From: Dan Williams
Date: Thu Oct 20 2022 - 20:33:11 EST
Robert Richter wrote:
> CXL dports are added in a couple of code paths using devm_cxl_add_
> dport(). Debug messages are individually generated, but are incomplete
> and inconsistent. Change this by moving its generation to devm_cxl_
> add_dport(). This unifies the messages and reduces code duplication.
> Also, generate messages on failure. Use a __devm_cxl_add_dport()
> wrapper to keep the readability of the error exits.
Looks good, I fixed up the wrapping of devm_cxl_add_dport() and one more
fixup below, but applied for v6.2.
>
> Signed-off-by: Robert Richter <rrichter@xxxxxxx>
> ---
> drivers/cxl/acpi.c | 7 ++----
> drivers/cxl/core/pci.c | 2 --
> drivers/cxl/core/port.c | 48 +++++++++++++++++++++++++-----------
> tools/testing/cxl/test/cxl.c | 8 +-----
> 4 files changed, 37 insertions(+), 28 deletions(-)
>
[..]
> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index a072b2d3e726..c610625e8261 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
> @@ -582,14 +582,8 @@ static int mock_cxl_port_enumerate_dports(struct cxl_port *port)
> dport = devm_cxl_add_dport(port, &pdev->dev, pdev->id,
> CXL_RESOURCE_NONE);
>
> - if (IS_ERR(dport)) {
> - dev_err(dev, "failed to add dport: %s (%ld)\n",
> - dev_name(&pdev->dev), PTR_ERR(dport));
> + if (IS_ERR(dport))
> return PTR_ERR(dport);
> - }
> -
> - dev_dbg(dev, "add dport%d: %s\n", pdev->id,
> - dev_name(&pdev->dev));
This hunk causes this new compile error:
tools/testing/cxl/test/cxl.c: In function ‘mock_cxl_port_enumerate_dports’:
tools/testing/cxl/test/cxl.c:559:24: error: unused variable ‘dev’ [-Werror=unused-variable]
559 | struct device *dev = &port->dev;
| ^~~
cc1: all warnings being treated as errors
I fixed it up locally, but just double check that you are building
cxl_test if you touch tools/testing/cxl/:
make M=tools/testing/cxl