From: Tom Rini Date: Fri, 1 Feb 2019 10:17:58 -0500 Subject: [U-Boot] [PATCH v2 4/7] fs: ext4: constify the buffer passed to write functions In-Reply-To: <20190201143340.7663-5-jjhiblot@ti.com> References: <20190201143340.7663-1-jjhiblot@ti.com> <20190201143340.7663-5-jjhiblot@ti.com> Message-ID: <20190201151758.GU30838@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, Feb 01, 2019 at 03:33:37PM +0100, Jean-Jacques Hiblot wrote: > There is no need to modify the buffer passed to ext4fs_write_file(). > The memset() has no utility there, and comes probably from the equivalent > ext4fs_read_file() function. Can you please clarify the commit message a little? I assume if we re-worded the second sentence to this, it would still be correct: The memset() call is not required here and was likely copied from the equivalent part of the ext4fs_read_file() function where we do need it. And if not, can you please explain why we don't need memset? Thanks! > Signed-off-by: Jean-Jacques Hiblot > --- > > Changes in v2: None > > fs/ext4/ext4_common.c | 2 +- > fs/ext4/ext4_common.h | 2 +- > fs/ext4/ext4_write.c | 11 +++++------ > include/ext4fs.h | 2 +- > 4 files changed, 8 insertions(+), 9 deletions(-) > > diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c > index 67e2471bd3..b881482c39 100644 > --- a/fs/ext4/ext4_common.c > +++ b/fs/ext4/ext4_common.c > @@ -190,7 +190,7 @@ uint32_t ext4fs_div_roundup(uint32_t size, uint32_t n) > return res; > } > > -void put_ext4(uint64_t off, void *buf, uint32_t size) > +void put_ext4(u64 off, const void *buf, u32 size) > { > uint64_t startblock; > uint64_t remainder; > diff --git a/fs/ext4/ext4_common.h b/fs/ext4/ext4_common.h > index 1ee81ab7ce..50155eccfc 100644 > --- a/fs/ext4/ext4_common.h > +++ b/fs/ext4/ext4_common.h > @@ -72,7 +72,7 @@ int ext4fs_iget(int inode_no, struct ext2_inode *inode); > void ext4fs_allocate_blocks(struct ext2_inode *file_inode, > unsigned int total_remaining_blocks, > unsigned int *total_no_of_block); > -void put_ext4(uint64_t off, void *buf, uint32_t size); > +void put_ext4(u64 off, const void *buf, u32 size); > struct ext2_block_group *ext4fs_get_group_descriptor > (const struct ext_filesystem *fs, uint32_t bg_idx); > uint64_t ext4fs_bg_get_block_id(const struct ext2_block_group *bg, Since the rest of the function is using uintXX_t not uXX can you please just change to const? -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: