Skip to content

Commit

Permalink
can: janz-ican3: Fix the usage of wait_for_completion_timeout
Browse files Browse the repository at this point in the history
The return value of wait_for_completion_timeout() is always
>= 0 with unsigned int type.

So the condition "ret < 0" or "ret >= 0" is pointless.

Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Chuansheng Liu authored and Marc Kleine-Budde committed Nov 15, 2012
1 parent 7653ebd commit c70edb9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/can/janz-ican3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ static int ican3_get_berr_counter(const struct net_device *ndev,
return ret;

ret = wait_for_completion_timeout(&mod->buserror_comp, HZ);
if (ret <= 0) {
if (ret == 0) {
dev_info(mod->dev, "%s timed out\n", __func__);
return -ETIMEDOUT;
}
Expand All @@ -1718,7 +1718,7 @@ static ssize_t ican3_sysfs_show_term(struct device *dev,
return ret;

ret = wait_for_completion_timeout(&mod->termination_comp, HZ);
if (ret <= 0) {
if (ret == 0) {
dev_info(mod->dev, "%s timed out\n", __func__);
return -ETIMEDOUT;
}
Expand Down

0 comments on commit c70edb9

Please sign in to comment.