Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1430793

Re: [PATCH] net: ethernet: ti: cpdma: switch to use genalloc

From "Lennart Sorensen" <lsorense@csclub.uwaterloo.ca>
Newsgroups linux.kernel
Subject Re: [PATCH] net: ethernet: ti: cpdma: switch to use genalloc
Date 2016-06-24 18:20 +0200
Message-ID <rNBZL-1W6-3@gated-at.bofh.it> (permalink)
References <rNc5k-1wG-27@gated-at.bofh.it> <rNcoG-1GG-41@gated-at.bofh.it> <rNstr-4rr-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jun 24, 2016 at 11:35:15AM +0530, Mugunthan V N wrote:
> >> +static void cpdma_desc_pool_destroy(struct cpdma_desc_pool *pool)
> >> +{
> >> +    if (!pool)
> >> +        return;
> >> +
> >> +    WARN_ON(pool->used_desc);
> >> +    if (pool->cpumap) {
> >> +        dma_free_coherent(pool->dev, pool->mem_size, pool->cpumap,
> >> +                  pool->phys);
> >> +    } else {
> >> +        iounmap(pool->iomap);
> >> +    }
> >> +}
> >> +
> > single if, brackets?
> 
> if() has multiple line statement, so brackets are must.

It is line wrapped, it is still one statement.  And you can't argue the
else being multiple lines, although the style does require using brackets
for the else if the if required them.

Style says "Do not unnecessarily use braces where a single statement will do."
It says statement, not line.  A multiline wrapped statement is still
one statement.

I may personally hate the lack of brackets, but style wise it seems very
clear that the linux kernel only uses brakcets when required, which is
only when there is more than one statement.  I prefer what you did,
but not as much as I prefer consistency.

-- 
Len Sorensen

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] net: ethernet: ti: cpdma: switch to use genalloc Mugunthan V N <mugunthanvnm@ti.com> - 2016-06-24 08:10 +0200
  Re: [PATCH] net: ethernet: ti: cpdma: switch to use genalloc Afzal Mohammed <afzal.mohd.ma@gmail.com> - 2016-06-24 14:00 +0200
  Re: [PATCH] net: ethernet: ti: cpdma: switch to use genalloc "Lennart Sorensen" <lsorense@csclub.uwaterloo.ca> - 2016-06-24 18:20 +0200
    Re: [PATCH] net: ethernet: ti: cpdma: switch to use genalloc Grygorii Strashko <grygorii.strashko@ti.com> - 2016-06-24 19:00 +0200
      Re: [PATCH] net: ethernet: ti: cpdma: switch to use genalloc "Lennart Sorensen" <lsorense@csclub.uwaterloo.ca> - 2016-06-24 20:40 +0200
    Re: [PATCH] net: ethernet: ti: cpdma: switch to use genalloc Afzal Mohammed <afzal.mohd.ma@gmail.com> - 2016-06-25 10:40 +0200

csiph-web