Re: [PATCH] staging: qlge: Remove macro FILL_SEG

From: Sumitra Sharma
Date: Thu Apr 06 2023 - 10:48:42 EST


On Wed, Apr 05, 2023 at 06:21:57PM +0200, Simon Horman wrote:
> On Wed, Apr 05, 2023 at 08:06:27AM -0700, Sumitra Sharma wrote:
> > Remove macro FILL_SEG to fix the checkpatch warning:
> >
> > WARNING: Macros with flow control statements should be avoided
> >
> > Macros with flow control statements must be avoided as they
> > break the flow of the calling function and make it harder to
> > test the code.
> >
> > Replace all FILL_SEG() macro calls with:
> >
> > err = err || qlge_fill_seg_(...);
>
> Perhaps I'm missing the point here.
> But won't this lead to err always either being true or false (1 or 0).
> Rather than the current arrangement where err can be
> either 0 or a negative error value, such as -EINVAL.
>

Hi Simon


Thank you for the point you mentioned which I missed while working on this
patch.

However, after thinking on it, I am still not able to get any fix to this
except that we can possibly implement the Ira's solution here which is:

https://lore.kernel.org/outreachy/64154d438f0c8_28ae5229421@iweiny-mobl.notmuch/

Although we have to then deal with 40 lines of ifs.



Regards

Sumitra



> ...