* [PATCH 1/9] drivers/media/usb/airspy/airspy.c: drop unneeded goto
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
2015-05-28 21:32 ` Joe Perches
2015-05-28 21:02 ` [PATCH 2/9] ipv6: " Julia Lawall
` (7 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
To: Antti Palosaari
Cc: kernel-janitors, Mauro Carvalho Chehab, linux-media, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete jump to a label on the next line, when that label is not
used elsewhere.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier l;
@@
-if (...) goto l;
-l:
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/usb/airspy/airspy.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c
index 4069234..8f2e1c2 100644
--- a/drivers/media/usb/airspy/airspy.c
+++ b/drivers/media/usb/airspy/airspy.c
@@ -937,9 +937,6 @@ static int airspy_set_if_gain(struct airspy *s)
ret = airspy_ctrl_msg(s, CMD_SET_VGA_GAIN, 0, s->if_gain->val,
&u8tmp, 1);
if (ret)
- goto err;
-err:
- if (ret)
dev_dbg(s->dev, "failed=%d\n", ret);
return ret;
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 1/9] drivers/media/usb/airspy/airspy.c: drop unneeded goto
2015-05-28 21:02 ` [PATCH 1/9] drivers/media/usb/airspy/airspy.c: " Julia Lawall
@ 2015-05-28 21:32 ` Joe Perches
0 siblings, 0 replies; 14+ messages in thread
From: Joe Perches @ 2015-05-28 21:32 UTC (permalink / raw)
To: Julia Lawall
Cc: Antti Palosaari, kernel-janitors, Mauro Carvalho Chehab,
linux-media, linux-kernel
On Thu, 2015-05-28 at 23:02 +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Delete jump to a label on the next line, when that label is not
> used elsewhere.
Seems sensible but:
> diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c
[]
> @@ -937,9 +937,6 @@ static int airspy_set_if_gain(struct airspy *s)
> ret = airspy_ctrl_msg(s, CMD_SET_VGA_GAIN, 0, s->if_gain->val,
> &u8tmp, 1);
> if (ret)
> - goto err;
> -err:
> - if (ret)
> dev_dbg(s->dev, "failed=%d\n", ret);
>
> return ret;
Ideally the function above this should also be modified
do drop the unnecessary double test of ret
static int airspy_set_mixer_gain(struct airspy *s)
{
int ret;
u8 u8tmp;
dev_dbg(s->dev, "mixer auto=%d->%d val=%d->%d\n",
s->mixer_gain_auto->cur.val, s->mixer_gain_auto->val,
s->mixer_gain->cur.val, s->mixer_gain->val);
ret = airspy_ctrl_msg(s, CMD_SET_MIXER_AGC, 0, s->mixer_gain_auto->val,
&u8tmp, 1);
if (ret)
goto err;
if (s->mixer_gain_auto->val == false) {
ret = airspy_ctrl_msg(s, CMD_SET_MIXER_GAIN, 0,
s->mixer_gain->val, &u8tmp, 1);
if (ret)
goto err;
}
err:
if (ret)
dev_dbg(s->dev, "failed=%d\n", ret);
return ret;
}
These could become something like:
static int airspy_set_mixer_gain(struct airspy *s)
{
int ret;
u8 u8tmp;
dev_dbg(s->dev, "mixer auto=%d->%d val=%d->%d\n",
s->mixer_gain_auto->cur.val, s->mixer_gain_auto->val,
s->mixer_gain->cur.val, s->mixer_gain->val);
ret = airspy_ctrl_msg(s, CMD_SET_MIXER_AGC, 0, s->mixer_gain_auto->val,
&u8tmp, 1);
if (ret)
goto err;
if (s->mixer_gain_auto->val == false) {
ret = airspy_ctrl_msg(s, CMD_SET_MIXER_GAIN, 0,
s->mixer_gain->val, &u8tmp, 1);
if (ret)
goto err;
}
return 0;
err:
dev_dbg(s->dev, "failed=%d\n", ret);
return ret;
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/9] ipv6: drop unneeded goto
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
2015-05-28 21:02 ` [PATCH 1/9] drivers/media/usb/airspy/airspy.c: " Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
2015-05-31 6:49 ` David Miller
2015-05-28 21:02 ` [PATCH 3/9] NFS: " Julia Lawall
` (6 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
To: David S. Miller
Cc: kernel-janitors, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, netdev, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete jump to a label on the next line, when that label is not
used elsewhere.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier l;
@@
-if (...) goto l;
-l:
// </smpl>
Also remove the unnecessary ret variable.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
net/ipv6/raw.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 484a5c1..ca4700c 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1327,13 +1327,7 @@ static struct inet_protosw rawv6_protosw = {
int __init rawv6_init(void)
{
- int ret;
-
- ret = inet6_register_protosw(&rawv6_protosw);
- if (ret)
- goto out;
-out:
- return ret;
+ return inet6_register_protosw(&rawv6_protosw);
}
void rawv6_exit(void)
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 2/9] ipv6: drop unneeded goto
2015-05-28 21:02 ` [PATCH 2/9] ipv6: " Julia Lawall
@ 2015-05-31 6:49 ` David Miller
0 siblings, 0 replies; 14+ messages in thread
From: David Miller @ 2015-05-31 6:49 UTC (permalink / raw)
To: Julia.Lawall
Cc: kernel-janitors, kuznet, jmorris, yoshfuji, kaber, netdev,
linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Thu, 28 May 2015 23:02:17 +0200
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Delete jump to a label on the next line, when that label is not
> used elsewhere.
>
> A simplified version of the semantic patch that makes this change is as
> follows: (http://coccinelle.lip6.fr/)
...
> Also remove the unnecessary ret variable.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Applied, thanks Julia.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/9] NFS: drop unneeded goto
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
2015-05-28 21:02 ` [PATCH 1/9] drivers/media/usb/airspy/airspy.c: " Julia Lawall
2015-05-28 21:02 ` [PATCH 2/9] ipv6: " Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
2015-05-28 21:02 ` [PATCH 4/9] RDMA/ocrdma: " Julia Lawall
` (5 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
To: Trond Myklebust; +Cc: kernel-janitors, Anna Schumaker, linux-nfs, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete jump to a label on the next line, when that label is not
used elsewhere.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier l;
@@
-if (...) goto l;
-l:
// </smpl>
Also drop the unnecessary ret variable.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
fs/nfs/nfs4idmap.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/fs/nfs/nfs4idmap.c b/fs/nfs/nfs4idmap.c
index 2e1737c..535dfc6 100644
--- a/fs/nfs/nfs4idmap.c
+++ b/fs/nfs/nfs4idmap.c
@@ -494,12 +494,7 @@ nfs_idmap_delete(struct nfs_client *clp)
int nfs_idmap_init(void)
{
- int ret;
- ret = nfs_idmap_init_keyring();
- if (ret != 0)
- goto out;
-out:
- return ret;
+ return nfs_idmap_init_keyring();
}
void nfs_idmap_quit(void)
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 4/9] RDMA/ocrdma: drop unneeded goto
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
` (2 preceding siblings ...)
2015-05-28 21:02 ` [PATCH 3/9] NFS: " Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
2015-05-28 21:02 ` [PATCH 5/9] wl1251: " Julia Lawall
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
To: Selvin Xavier
Cc: kernel-janitors, Devesh Sharma, Mitesh Ahuja, Doug Ledford,
Sean Hefty, Hal Rosenstock, linux-rdma, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete jump to a label on the next line, when that label is not
used elsewhere.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier l;
@@
-if (...) goto l;
-l:
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 47615ff..0f3b5ea 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -1884,9 +1884,7 @@ int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev *dev, int fr_mr, u32 lkey)
cmd->lkey = lkey;
cmd->rsvd_frmr = fr_mr ? 1 : 0;
status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
- if (status)
- goto mbx_err;
-mbx_err:
+
kfree(cmd);
return status;
}
@@ -1965,9 +1963,7 @@ static int ocrdma_mbx_reg_mr_cont(struct ocrdma_dev *dev,
upper_32_bits(hwmr->pbl_table[i + pbl_offset].pa);
}
status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
- if (status)
- goto mbx_err;
-mbx_err:
+
kfree(cmd);
return status;
}
@@ -2648,10 +2644,7 @@ int ocrdma_mbx_destroy_qp(struct ocrdma_dev *dev, struct ocrdma_qp *qp)
return status;
cmd->qp_id = qp->id;
status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
- if (status)
- goto mbx_err;
-mbx_err:
kfree(cmd);
if (qp->sq.va)
dma_free_coherent(&pdev->dev, qp->sq.len, qp->sq.va, qp->sq.pa);
@@ -3061,9 +3054,7 @@ static int ocrdma_mbx_modify_eqd(struct ocrdma_dev *dev, struct ocrdma_eq *eq,
(eq[i].aic_obj.prev_eqd * 65)/100;
}
status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd);
- if (status)
- goto mbx_err;
-mbx_err:
+
kfree(cmd);
return status;
}
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 5/9] wl1251: drop unneeded goto
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
` (3 preceding siblings ...)
2015-05-28 21:02 ` [PATCH 4/9] RDMA/ocrdma: " Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
2015-06-08 8:39 ` [5/9] " Kalle Valo
2015-05-28 21:02 ` [PATCH 6/9] ssb: " Julia Lawall
` (3 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
To: Kalle Valo; +Cc: kernel-janitors, linux-wireless, netdev, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete jump to a label on the next line, when that label is not
used elsewhere.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier l;
@@
-if (...) goto l;
-l:
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/net/wireless/ti/wl1251/acx.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c
index 5695628..d6fbdda 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -53,10 +53,7 @@ int wl1251_acx_station_id(struct wl1251 *wl)
mac->mac[i] = wl->mac_addr[ETH_ALEN - 1 - i];
ret = wl1251_cmd_configure(wl, DOT11_STATION_ID, mac, sizeof(*mac));
- if (ret < 0)
- goto out;
-out:
kfree(mac);
return ret;
}
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 6/9] ssb: drop unneeded goto
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
` (4 preceding siblings ...)
2015-05-28 21:02 ` [PATCH 5/9] wl1251: " Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
2015-05-28 21:02 ` [PATCH 7/9] drivers/media/tuners/e4000.c: " Julia Lawall
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
To: Michael Buesch; +Cc: kernel-janitors, netdev, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete jump to a label on the next line, when that label is not
used elsewhere.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier l;
@@
-if (...) goto l;
-l:
// </smpl>
Also drop the unneeded err variable.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/ssb/pci.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index 0f28c08..d6ca4d3 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -1173,17 +1173,11 @@ void ssb_pci_exit(struct ssb_bus *bus)
int ssb_pci_init(struct ssb_bus *bus)
{
struct pci_dev *pdev;
- int err;
if (bus->bustype != SSB_BUSTYPE_PCI)
return 0;
pdev = bus->host_pci;
mutex_init(&bus->sprom_mutex);
- err = device_create_file(&pdev->dev, &dev_attr_ssb_sprom);
- if (err)
- goto out;
-
-out:
- return err;
+ return device_create_file(&pdev->dev, &dev_attr_ssb_sprom);
}
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 7/9] drivers/media/tuners/e4000.c: drop unneeded goto
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
` (5 preceding siblings ...)
2015-05-28 21:02 ` [PATCH 6/9] ssb: " Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
2015-05-28 21:02 ` [PATCH 8/9] staging/lustre/mdc: " Julia Lawall
2015-05-28 21:02 ` [PATCH 9/9] regmap: " Julia Lawall
8 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
To: Antti Palosaari
Cc: kernel-janitors, Mauro Carvalho Chehab, linux-media, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete jump to a label on the next line, when that label is not
used elsewhere.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier l;
@@
-if (...) goto l;
-l:
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/tuners/e4000.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index 510239f..50c0f0d 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -103,9 +103,6 @@ static int e4000_sleep(struct dvb_frontend *fe)
ret = regmap_write(s->regmap, 0x00, 0x00);
if (ret)
- goto err;
-err:
- if (ret)
dev_dbg(&s->client->dev, "failed=%d\n", ret);
return ret;
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 8/9] staging/lustre/mdc: drop unneeded goto
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
` (6 preceding siblings ...)
2015-05-28 21:02 ` [PATCH 7/9] drivers/media/tuners/e4000.c: " Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
2015-05-28 21:02 ` [PATCH 9/9] regmap: " Julia Lawall
8 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
To: Oleg Drokin
Cc: kernel-janitors, Andreas Dilger, Greg Kroah-Hartman, HPDD-discuss,
devel, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete jump to a label on the next line, when that label is not
used elsewhere.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier l;
@@
-if (...) goto l;
-l:
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/staging/lustre/lustre/mdc/mdc_request.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index cbbdfce..0f120f2 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -1818,10 +1818,7 @@ static int mdc_ioc_swap_layouts(struct obd_export *exp,
ptlrpc_request_set_replen(req);
rc = ptlrpc_queue_wait(req);
- if (rc)
- goto out;
-out:
ptlrpc_req_finished(req);
return rc;
}
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 9/9] regmap: drop unneeded goto
2015-05-28 21:02 [PATCH 0/9] drop unneeded goto Julia Lawall
` (7 preceding siblings ...)
2015-05-28 21:02 ` [PATCH 8/9] staging/lustre/mdc: " Julia Lawall
@ 2015-05-28 21:02 ` Julia Lawall
2015-05-29 9:37 ` Mark Brown
8 siblings, 1 reply; 14+ messages in thread
From: Julia Lawall @ 2015-05-28 21:02 UTC (permalink / raw)
To: Mark Brown; +Cc: kernel-janitors, Greg Kroah-Hartman, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Delete jump to a label on the next line, when that label is not
used elsewhere.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@r@
identifier l;
@@
-if (...) goto l;
-l:
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/base/regmap/regmap.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index e5eef6f..3378a11 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2583,10 +2583,7 @@ int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
map->async = true;
ret = _regmap_multi_reg_write(map, regs, num_regs);
- if (ret != 0)
- goto out;
-out:
map->async = false;
map->cache_bypass = bypass;
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 9/9] regmap: drop unneeded goto
2015-05-28 21:02 ` [PATCH 9/9] regmap: " Julia Lawall
@ 2015-05-29 9:37 ` Mark Brown
0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2015-05-29 9:37 UTC (permalink / raw)
To: Julia Lawall; +Cc: kernel-janitors, Greg Kroah-Hartman, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 218 bytes --]
On Thu, May 28, 2015 at 11:02:24PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Delete jump to a label on the next line, when that label is not
> used elsewhere.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread