[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20141107190211.GA15864@kroah.com>
Date: Fri, 7 Nov 2014 11:02:11 -0800
From: Greg KH <gregkh@...uxfoundation.org>
To: Liu Ying <Ying.Liu@...escale.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drvres: Improve grp->id setting logics in
devres_open_group()
On Wed, Oct 29, 2014 at 05:59:47PM +0800, Liu Ying wrote:
> Instead of setting grp->id directly with a temporary value and
> then changing it if a certain condition meets, we may check
> the condition first and then decide which value should be set
> to grp->id. This may save two lines of code and potentially
> reduces a writing operation.
>
> Signed-off-by: Liu Ying <Ying.Liu@...escale.com>
> ---
> drivers/base/devres.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/base/devres.c b/drivers/base/devres.c
> index c8a53d1..39e1856 100644
> --- a/drivers/base/devres.c
> +++ b/drivers/base/devres.c
> @@ -544,9 +544,7 @@ void * devres_open_group(struct device *dev, void *id, gfp_t gfp)
> INIT_LIST_HEAD(&grp->node[1].entry);
> set_node_dbginfo(&grp->node[0], "grp<", 0);
> set_node_dbginfo(&grp->node[1], "grp>", 0);
> - grp->id = grp;
> - if (id)
> - grp->id = id;
> + grp->id = id ? id : grp;
Ick, I _hate_ ? : lines, please don't do that.
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists