lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230715175139.2b0ebaae@jic23-huawei>
Date:   Sat, 15 Jul 2023 17:51:39 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Waqar Hameed <waqar.hameed@...s.com>
Cc:     Lars-Peter Clausen <lars@...afoo.de>,
        <linux-kernel@...r.kernel.org>, <linux-iio@...r.kernel.org>,
        <kernel@...s.com>
Subject: Re: [PATCH 2/2] iio: Add driver for Murata IRS-D200

On Wed, 12 Jul 2023 17:33:09 +0200
Waqar Hameed <waqar.hameed@...s.com> wrote:

> On Sun, Jun 25, 2023 at 12:06 +0100 Jonathan Cameron <jic23@...nel.org> wrote:
> 
> [...]
> 
> >> >> +		dev_err(data->dev, "Could not write hp filter frequency (%d)\n",
> >> >> +			ret);
> >> >> +		return ret;    
> >> >
> >> > drop this return ret out of the if block here.
> >> >
> >> > In general being able to ignore possibility of ret > 0 simplifies handling.    
> >> 
> >> I try to be consistent and it also "helps" the next person potentially
> >> adding code after the `if`-statement and forgetting about adding
> >> `return`. We can drop the `return here, but then we should do the same
> >> in other places with a check just before the last `return` (like
> >> `irsd200_write_timer()`, `irsd200_read_nr_count()`,
> >> `irsd200_write_nr_count()` and many more), right?  
> >
> > I don't feel particulartly strongly about this, but there are scripts
> > that get used to scan for this pattern to simplify the code.
> >
> > Sure on the other cases. I don't tend to try and label all cases of things
> > pointed out, just pick on one and rely on the patch author to generalise.  
> 
> I started to remove the returns but then realized that it got a little
> messy. For example, in some cases we can't drop the return (side effects
> after the return etc.). 
> 
> Since you didn't have any strong opinions on this, I kept them in v2.
> Hope that's fine!

Absolutely.   I wasn't advocating removing separate returns in general, just this
cases where there was nothing after the if check.

Thanks,

Jonathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ