Am Donnerstag, 27. Januar 2022, 17:16:35 CET schrieb John David Anglin: > On 2022-01-27 1:58 a.m., Helge Deller wrote: > >>> diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c > >>> index e60690d38d67..374b9199878d 100644 > >>> --- a/drivers/parisc/sba_iommu.c > >>> +++ b/drivers/parisc/sba_iommu.c > >>> @@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct > >>> scatterlist > >>> *sglist, int nents, spin_unlock_irqrestore(&ioc->res_lock, flags); > >>> > >>> #endif > >>> > >>> - while (sg_dma_len(sglist) && nents--) { > >>> + while (nents && sg_dma_len(sglist)) { > >> > >> What about: > >> for (; nents && sg_dma_len(sglist); nents--) { > > > > The way how Dave wrote it is more clean, IMHO. > > I'm going to leave the change to sba_iommu.c as proposed. While i'm sure > the suggested for statement would be fine, I looked at how gcc handled the > while loop. It is quite subtle. Except for an initial test and decrement, > the iteration of nents is replaced by a calculation of the the final value > for sglist. > > Regarding the newline, the file has several places where newlines precede > #ifdef statements. I think the current style is okay and checkpatch.pl > doesn't object to that format. It was not about the #ifdef, it was the line immediately following the opening brace of the loop. Eike
Attachment:
signature.asc
Description: This is a digitally signed message part.