Commit fc5c7f3d authored by Julia Lawall's avatar Julia Lawall Committed by Greg Kroah-Hartman

staging: lustre: libcfs: expand the GOTO macro

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier lbl;
identifier rc;
constant c;
@@

- GOTO(lbl,\(rc\|c\));
+ goto lbl;

@@
identifier lbl;
expression rc;
@@

- GOTO(lbl,rc);
+ rc;
+ goto lbl;
// </smpl>
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 82604f8c
...@@ -301,7 +301,8 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *a ...@@ -301,7 +301,8 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *a
/* 'cmd' and permissions get checked in our arch-specific caller */ /* 'cmd' and permissions get checked in our arch-specific caller */
if (libcfs_ioctl_getdata(buf, buf + 800, (void *)arg)) { if (libcfs_ioctl_getdata(buf, buf + 800, (void *)arg)) {
CERROR("PORTALS ioctl: data error\n"); CERROR("PORTALS ioctl: data error\n");
GOTO(out, err = -EINVAL); err = -EINVAL;
goto out;
} }
data = (struct libcfs_ioctl_data *)buf; data = (struct libcfs_ioctl_data *)buf;
......
...@@ -205,7 +205,8 @@ struct upcall_cache_entry *upcall_cache_get_entry(struct upcall_cache *cache, ...@@ -205,7 +205,8 @@ struct upcall_cache_entry *upcall_cache_get_entry(struct upcall_cache *cache,
wake_up_all(&entry->ue_waitq); wake_up_all(&entry->ue_waitq);
if (unlikely(rc == -EREMCHG)) { if (unlikely(rc == -EREMCHG)) {
put_entry(cache, entry); put_entry(cache, entry);
GOTO(out, entry = ERR_PTR(rc)); entry = ERR_PTR(rc);
goto out;
} }
} }
} }
...@@ -232,14 +233,16 @@ struct upcall_cache_entry *upcall_cache_get_entry(struct upcall_cache *cache, ...@@ -232,14 +233,16 @@ struct upcall_cache_entry *upcall_cache_get_entry(struct upcall_cache *cache,
CERROR("acquire for key %llu: error %d\n", CERROR("acquire for key %llu: error %d\n",
entry->ue_key, rc); entry->ue_key, rc);
put_entry(cache, entry); put_entry(cache, entry);
GOTO(out, entry = ERR_PTR(rc)); entry = ERR_PTR(rc);
goto out;
} }
} }
/* invalid means error, don't need to try again */ /* invalid means error, don't need to try again */
if (UC_CACHE_IS_INVALID(entry)) { if (UC_CACHE_IS_INVALID(entry)) {
put_entry(cache, entry); put_entry(cache, entry);
GOTO(out, entry = ERR_PTR(-EIDRM)); entry = ERR_PTR(-EIDRM);
goto out;
} }
/* check expired /* check expired
...@@ -312,19 +315,22 @@ int upcall_cache_downcall(struct upcall_cache *cache, __u32 err, __u64 key, ...@@ -312,19 +315,22 @@ int upcall_cache_downcall(struct upcall_cache *cache, __u32 err, __u64 key,
if (err) { if (err) {
CDEBUG(D_OTHER, "%s: upcall for key %llu returned %d\n", CDEBUG(D_OTHER, "%s: upcall for key %llu returned %d\n",
cache->uc_name, entry->ue_key, err); cache->uc_name, entry->ue_key, err);
GOTO(out, rc = -EINVAL); rc = -EINVAL;
goto out;
} }
if (!UC_CACHE_IS_ACQUIRING(entry)) { if (!UC_CACHE_IS_ACQUIRING(entry)) {
CDEBUG(D_RPCTRACE, "%s: found uptodate entry %p (key %llu)\n", CDEBUG(D_RPCTRACE, "%s: found uptodate entry %p (key %llu)\n",
cache->uc_name, entry, entry->ue_key); cache->uc_name, entry, entry->ue_key);
GOTO(out, rc = 0); rc = 0;
goto out;
} }
if (UC_CACHE_IS_INVALID(entry) || UC_CACHE_IS_EXPIRED(entry)) { if (UC_CACHE_IS_INVALID(entry) || UC_CACHE_IS_EXPIRED(entry)) {
CERROR("%s: found a stale entry %p (key %llu) in ioctl\n", CERROR("%s: found a stale entry %p (key %llu) in ioctl\n",
cache->uc_name, entry, entry->ue_key); cache->uc_name, entry, entry->ue_key);
GOTO(out, rc = -EINVAL); rc = -EINVAL;
goto out;
} }
spin_unlock(&cache->uc_lock); spin_unlock(&cache->uc_lock);
...@@ -332,7 +338,7 @@ int upcall_cache_downcall(struct upcall_cache *cache, __u32 err, __u64 key, ...@@ -332,7 +338,7 @@ int upcall_cache_downcall(struct upcall_cache *cache, __u32 err, __u64 key,
rc = cache->uc_ops->parse_downcall(cache, entry, args); rc = cache->uc_ops->parse_downcall(cache, entry, args);
spin_lock(&cache->uc_lock); spin_lock(&cache->uc_lock);
if (rc) if (rc)
GOTO(out, rc); goto out;
entry->ue_expire = cfs_time_shift(cache->uc_entry_expire); entry->ue_expire = cfs_time_shift(cache->uc_entry_expire);
UC_CACHE_SET_VALID(entry); UC_CACHE_SET_VALID(entry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment