Hi I think that the code is more readable as it is.
Putting two function calls on one line doesn't make it easier to read. Mikulas On Fri, 31 Oct 2025, Markus Elfring wrote: > From: Markus Elfring <[email protected]> > Date: Fri, 31 Oct 2025 20:20:56 +0100 > > A pointer was assigned to a variable in two function implementations. > The same pointer was used for the destination parameter of a memcpy() call. > This function is documented in the way that the same value is returned. > Thus convert separate statements into a direct variable assignment for > the return value from a memory copy action. > > The source code was transformed by using the Coccinelle software. > > Signed-off-by: Markus Elfring <[email protected]> > --- > drivers/md/dm-log-writes.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c > index 7bb7174f8f4f..b450bdadfaf2 100644 > --- a/drivers/md/dm-log-writes.c > +++ b/drivers/md/dm-log-writes.c > @@ -232,8 +232,7 @@ static int write_metadata(struct log_writes_c *lc, void > *entry, > goto error; > } > > - ptr = kmap_local_page(page); > - memcpy(ptr, entry, entrylen); > + ptr = memcpy(kmap_local_page(page), entry, entrylen); > if (datalen) > memcpy(ptr + entrylen, data, datalen); > memset(ptr + entrylen + datalen, 0, > @@ -287,8 +286,7 @@ static int write_inline_data(struct log_writes_c *lc, > void *entry, > goto error_bio; > } > > - ptr = kmap_local_page(page); > - memcpy(ptr, data, pg_datalen); > + ptr = memcpy(kmap_local_page(page), data, pg_datalen); > if (pg_sectorlen > pg_datalen) > memset(ptr + pg_datalen, 0, pg_sectorlen - > pg_datalen); > kunmap_local(ptr); > -- > 2.51.1 >
