Re: [PATCH 4/4] iio: dac: ad3552r-hs: add support for internal ramp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2025-03-27 at 09:09 -0300, Marcelo Schmitt wrote:
> On 03/27, Angelo Dureghello wrote:
> > On 26.03.2025 18:52, Marcelo Schmitt wrote:
> > > Hello Angelo,
> > > 
> > > Patch looks good to me.
> > > One minor comment bellow.
> > > 
> > > On 03/21, Angelo Dureghello wrote:
> > > > From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
> > > > 
> ...
> > > > +
> > > > +static ssize_t ad3552r_hs_write_data_source(struct file *f,
> > > > +					    const char __user *userbuf,
> > > > +					    size_t count, loff_t *ppos)
> > > > +{
> > > > +	struct ad3552r_hs_state *st = file_inode(f)->i_private;
> > > > +	char buf[64];
> > > > +	int ret;
> > > > +
> > > > +	ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, userbuf,
> > > > +				     count);
> > > > +	if (ret < 0)
> > > > +		return ret;
> > > > +
> > > > +	buf[count] = 0;
> > > Shouldn't it be
> > > 	buf[count] = '\0';
> > 
> > Why ? I am zero-terminating the string properly.
> 
> Oh, okay. I was just more used to see '\0' as buffer/string terminator.
> I see now buf[count] = 0; should work too.
> 

I agree with Marcelo that the more natural/readable way for terminating a string is
using the corresponding null character (ascii). Probably not a reason for a v2
though...

- Nuno Sá 






[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux