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


Groups > linux.kernel > #1666134

Re: [PATCH 6/6] staging: lustre: lustre: fix all braces issues reported by checkpatch

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH 6/6] staging: lustre: lustre: fix all braces issues reported by checkpatch
Date 2017-06-14 20:30 +0200
Message-ID <tSldf-cr-1@gated-at.bofh.it> (permalink)
References <tSi5I-6MW-17@gated-at.bofh.it> <tSi5K-6MW-91@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 2017-06-14 at 11:01 -0400, James Simmons wrote:
> Cleanup all braces that was reported by checkpatch. The only
> issue not fixed up is in mdc_lock.c. Removing the braces in
> the case of mdc_lock.c will break the build.

[]

> diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c
[]
> @@ -591,9 +591,10 @@ static void *vvp_pgcache_start(struct seq_file *f, loff_t *pos)
>  	env = cl_env_get(&refcheck);
>  	if (!IS_ERR(env)) {
>  		sbi = f->private;
> -		if (sbi->ll_site->ls_obj_hash->hs_cur_bits > 64 - PGC_OBJ_SHIFT)
> +		if (sbi->ll_site->ls_obj_hash->hs_cur_bits >
> +		    64 - PGC_OBJ_SHIFT) {
>  			pos = ERR_PTR(-EFBIG);
> -		else {
> +		} else {
>  			*pos = vvp_pgcache_find(env, &sbi->ll_cl->cd_lu_dev,
>  						*pos);
>  			if (*pos == ~0ULL)

Sometimes is nicer to rearrange the code with smaller
indentation by using early returns and/or goto <labels>.

Something like:

static void *vvp_pgcache_start(struct seq_file *f, loff_t *pos)
{
	struct ll_sb_info *sbi;
	struct lu_env     *env;
	u16 refcheck;

	sbi = f->private;

	env = cl_env_get(&refcheck);
	if (IS_ERR(env))
		return pos;

	sbi = f->private;
	if (sbi->ll_site->ls_obj_hash->hs_cur_bits > 64 - PGC_OBJ_SHIFT) {
		pos = ERR_PTR(-EFBIG);
		goto out;
	}

	*pos = vvp_pgcache_find(env, &sbi->ll_cl->cd_lu_dev, *pos);
	if (*pos == ~0ULL)
		pos = NULL;

out:
	cl_env_put(env, &refcheck);

	return pos;
}

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


Thread

[PATCH 0/6] staging: lustre: lustre: assortment of checkpatch cleanups James Simmons <jsimmons@infradead.org> - 2017-06-14 17:10 +0200
  [PATCH 6/6] staging: lustre: lustre: fix all braces issues reported by checkpatch James Simmons <jsimmons@infradead.org> - 2017-06-14 17:10 +0200
    Re: [PATCH 6/6] staging: lustre: lustre: fix all braces issues  reported by checkpatch Joe Perches <joe@perches.com> - 2017-06-14 20:30 +0200
      Re: [PATCH 6/6] staging: lustre: lustre: fix all braces issues  reported by checkpatch James Simmons <jsimmons@infradead.org> - 2017-06-15 18:40 +0200
        Re: [PATCH 6/6] staging: lustre: lustre: fix all braces issues  reported by checkpatch Joe Perches <joe@perches.com> - 2017-06-15 19:00 +0200
  Re: [PATCH 1/6] staging: lustre: lustre: resolve "use spaces  between elements" checkpatch errors Joe Perches <joe@perches.com> - 2017-06-14 20:20 +0200
    Re: [PATCH 1/6] staging: lustre: lustre: resolve "use spaces between  elements" checkpatch errors James Simmons <jsimmons@infradead.org> - 2017-06-15 18:10 +0200
      Re: [PATCH 1/6] staging: lustre: lustre: resolve "use spaces  between elements" checkpatch errors Joe Perches <joe@perches.com> - 2017-06-15 18:30 +0200
        Re: [PATCH 1/6] staging: lustre: lustre: resolve "use spaces between  elements" checkpatch errors James Simmons <jsimmons@infradead.org> - 2017-06-15 19:00 +0200
          Re: [PATCH 1/6] staging: lustre: lustre: resolve "use spaces  between elements" checkpatch errors Joe Perches <joe@perches.com> - 2017-06-15 19:10 +0200
            Re: [PATCH 1/6] staging: lustre: lustre: resolve "use spaces between  elements" checkpatch errors James Simmons <jsimmons@infradead.org> - 2017-06-15 19:20 +0200
  Re: [PATCH 5/6] staging: lustre: lustre: several over 80 characters  cleanups Joe Perches <joe@perches.com> - 2017-06-14 20:20 +0200
    Re: [PATCH 5/6] staging: lustre: lustre: several over 80 characters  cleanups James Simmons <jsimmons@infradead.org> - 2017-06-15 18:10 +0200
      Re: [PATCH 5/6] staging: lustre: lustre: several over 80 characters  cleanups Joe Perches <joe@perches.com> - 2017-06-15 18:20 +0200

csiph-web