* [PATCH 4/15] drivers/net/ethernet/sfc/ptp.c: adjust duplicate test [not found] <1358773378-4700-1-git-send-email-Julia.Lawall@lip6.fr> @ 2013-01-21 13:02 ` Julia Lawall 2013-01-21 19:47 ` Ben Hutchings 2013-01-21 20:45 ` David Miller 2013-01-21 13:02 ` [PATCH 6/15] drivers/net/wireless/iwlegacy/4965-mac.c: " Julia Lawall 1 sibling, 2 replies; 5+ messages in thread From: Julia Lawall @ 2013-01-21 13:02 UTC (permalink / raw) To: Solarflare linux maintainers Cc: kernel-janitors, Ben Hutchings, netdev, linux-kernel From: Julia Lawall <Julia.Lawall@lip6.fr> Delete successive tests to the same location. rc was previously tested and not subsequently updated. efx_phc_adjtime can return an error code, so the call is updated so that is tested instead. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @s exists@ local idexpression y; expression x,e; @@ *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) { ... when forall return ...; } ... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\) when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\) *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) { ... when forall return ...; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- Not tested. I'm not familiar with this function, so I don't know whether it is desirable to test its result. drivers/net/ethernet/sfc/ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index 0767043..3f93624 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c @@ -1439,7 +1439,7 @@ static int efx_phc_settime(struct ptp_clock_info *ptp, delta = timespec_sub(*e_ts, time_now); - efx_phc_adjtime(ptp, timespec_to_ns(&delta)); + rc = efx_phc_adjtime(ptp, timespec_to_ns(&delta)); if (rc != 0) return rc; ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 4/15] drivers/net/ethernet/sfc/ptp.c: adjust duplicate test 2013-01-21 13:02 ` [PATCH 4/15] drivers/net/ethernet/sfc/ptp.c: adjust duplicate test Julia Lawall @ 2013-01-21 19:47 ` Ben Hutchings 2013-01-21 20:45 ` David Miller 1 sibling, 0 replies; 5+ messages in thread From: Ben Hutchings @ 2013-01-21 19:47 UTC (permalink / raw) To: Julia Lawall Cc: Solarflare linux maintainers, kernel-janitors, netdev, linux-kernel On Mon, 2013-01-21 at 14:02 +0100, Julia Lawall wrote: > From: Julia Lawall <Julia.Lawall@lip6.fr> > > Delete successive tests to the same location. rc was previously tested and > not subsequently updated. efx_phc_adjtime can return an error code, so the > call is updated so that is tested instead. > > A simplified version of the semantic match that finds this problem is as > follows: (http://coccinelle.lip6.fr/) > > // <smpl> > @s exists@ > local idexpression y; > expression x,e; > @@ > > *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) > { ... when forall > return ...; } > ... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\) > when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\) > *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) > { ... when forall > return ...; } > // </smpl> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Ben Hutchings <bhutchings@solarflare.com> > --- > Not tested. I'm not familiar with this function, so I don't know whether it > is desirable to test its result. Yes, the result should be tested. Thanks. Ben. > drivers/net/ethernet/sfc/ptp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c > index 0767043..3f93624 100644 > --- a/drivers/net/ethernet/sfc/ptp.c > +++ b/drivers/net/ethernet/sfc/ptp.c > @@ -1439,7 +1439,7 @@ static int efx_phc_settime(struct ptp_clock_info *ptp, > > delta = timespec_sub(*e_ts, time_now); > > - efx_phc_adjtime(ptp, timespec_to_ns(&delta)); > + rc = efx_phc_adjtime(ptp, timespec_to_ns(&delta)); > if (rc != 0) > return rc; > > -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4/15] drivers/net/ethernet/sfc/ptp.c: adjust duplicate test 2013-01-21 13:02 ` [PATCH 4/15] drivers/net/ethernet/sfc/ptp.c: adjust duplicate test Julia Lawall 2013-01-21 19:47 ` Ben Hutchings @ 2013-01-21 20:45 ` David Miller 1 sibling, 0 replies; 5+ messages in thread From: David Miller @ 2013-01-21 20:45 UTC (permalink / raw) To: Julia.Lawall Cc: linux-net-drivers, kernel-janitors, bhutchings, netdev, linux-kernel From: Julia Lawall <Julia.Lawall@lip6.fr> Date: Mon, 21 Jan 2013 14:02:48 +0100 > From: Julia Lawall <Julia.Lawall@lip6.fr> > > Delete successive tests to the same location. rc was previously tested and > not subsequently updated. efx_phc_adjtime can return an error code, so the > call is updated so that is tested instead. > > A simplified version of the semantic match that finds this problem is as > follows: (http://coccinelle.lip6.fr/) ... > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Applied to net-next, thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 6/15] drivers/net/wireless/iwlegacy/4965-mac.c: adjust duplicate test [not found] <1358773378-4700-1-git-send-email-Julia.Lawall@lip6.fr> 2013-01-21 13:02 ` [PATCH 4/15] drivers/net/ethernet/sfc/ptp.c: adjust duplicate test Julia Lawall @ 2013-01-21 13:02 ` Julia Lawall 2013-01-21 12:07 ` Stanislaw Gruszka 1 sibling, 1 reply; 5+ messages in thread From: Julia Lawall @ 2013-01-21 13:02 UTC (permalink / raw) To: Stanislaw Gruszka Cc: kernel-janitors, John W. Linville, linux-wireless, netdev, linux-kernel From: Julia Lawall <Julia.Lawall@lip6.fr> Delete successive tests to the same location. This looks like simple code duplication. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @s exists@ local idexpression y; expression x,e; @@ *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) { ... when forall return ...; } ... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\) when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\) *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) { ... when forall return ...; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/net/wireless/iwlegacy/4965-mac.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 10fc249..0195190 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c @@ -6572,9 +6572,6 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto out_free_eeprom; - if (err) - goto out_free_eeprom; - /* extract MAC Address */ il4965_eeprom_get_mac(il, il->addresses[0].addr); D_INFO("MAC address: %pM\n", il->addresses[0].addr); ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 6/15] drivers/net/wireless/iwlegacy/4965-mac.c: adjust duplicate test 2013-01-21 13:02 ` [PATCH 6/15] drivers/net/wireless/iwlegacy/4965-mac.c: " Julia Lawall @ 2013-01-21 12:07 ` Stanislaw Gruszka 0 siblings, 0 replies; 5+ messages in thread From: Stanislaw Gruszka @ 2013-01-21 12:07 UTC (permalink / raw) To: Julia Lawall Cc: kernel-janitors, John W. Linville, linux-wireless, netdev, linux-kernel On Mon, Jan 21, 2013 at 02:02:50PM +0100, Julia Lawall wrote: > From: Julia Lawall <Julia.Lawall@lip6.fr> > > Delete successive tests to the same location. This looks like simple code > duplication. > > A simplified version of the semantic match that finds this problem is as > follows: (http://coccinelle.lip6.fr/) > > // <smpl> > @s exists@ > local idexpression y; > expression x,e; > @@ > > *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) > { ... when forall > return ...; } > ... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\) > when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\) > *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) ) > { ... when forall > return ...; } > // </smpl> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> ACK ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-21 20:45 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1358773378-4700-1-git-send-email-Julia.Lawall@lip6.fr> 2013-01-21 13:02 ` [PATCH 4/15] drivers/net/ethernet/sfc/ptp.c: adjust duplicate test Julia Lawall 2013-01-21 19:47 ` Ben Hutchings 2013-01-21 20:45 ` David Miller 2013-01-21 13:02 ` [PATCH 6/15] drivers/net/wireless/iwlegacy/4965-mac.c: " Julia Lawall 2013-01-21 12:07 ` Stanislaw Gruszka
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).