[<prev] [next>] [day] [month] [year] [list]
Message-ID: <589ee57cfc275c5249885e1eace22e9bf3a9561d.1766326481.git.christophe.jaillet@wanadoo.fr>
Date: Sun, 21 Dec 2025 15:15:04 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-cxl@...r.kernel.org
Subject: [PATCH] cxl: Slightly simplify emit_target_list()
sysfs_emit_at() never returns a negative error code. It returns 0 or the
number of characters written in the buffer.
Remove the useless test. This simplifies the logic and saves a few lines of
code.
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
drivers/cxl/core/port.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index fef3aa0c6680..b77c1600beaa 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -151,7 +151,7 @@ static ssize_t emit_target_list(struct cxl_switch_decoder *cxlsd, char *buf)
{
struct cxl_decoder *cxld = &cxlsd->cxld;
ssize_t offset = 0;
- int i, rc = 0;
+ int i;
for (i = 0; i < cxld->interleave_ways; i++) {
struct cxl_dport *dport = cxlsd->target[i];
@@ -162,11 +162,9 @@ static ssize_t emit_target_list(struct cxl_switch_decoder *cxlsd, char *buf)
if (i + 1 < cxld->interleave_ways)
next = cxlsd->target[i + 1];
- rc = sysfs_emit_at(buf, offset, "%d%s", dport->port_id,
- next ? "," : "");
- if (rc < 0)
- return rc;
- offset += rc;
+ offset += sysfs_emit_at(buf, offset, "%d%s",
+ dport->port_id,
+ next ? "," : "");
}
return offset;
--
2.52.0
Powered by blists - more mailing lists