mei: me: unneeded tests in mei_me_hw_ready_wait()

From: Paul Bolle
Date: Fri Dec 27 2013 - 15:45:00 EST


0) mei_me_hw_ready_wait() currently reads:
int err;
[...]

err = wait_event_interruptible_timeout(dev->wait_hw_ready,
dev->recvd_hw_ready,
mei_secs_to_jiffies(MEI_INTEROP_TIMEOUT));
[...]
if (!err && !dev->recvd_hw_ready) {
if (!err)
err = -ETIMEDOUT;
dev_err(&dev->pdev->dev,
"wait hw ready failed. status = %d\n", err);
return err;
}
[...]

1) The second check for !err was introduced in commit dab9bf41b23f
("mei: me: fix waiting for hw ready"). It's not needed. And the check
for !dev->recvd_hw_ready seems unneeded too.

2) So perhaps something like this was intended:
[...]
if (err <= 0) {
if (!err)
err = -ETIMEDOUT;
dev_err(&dev->pdev->dev,
"wait hw ready failed. status = %d\n", err);
return err;
}
[...]

But that's just a guess. For example: it is unclear whether that would
handle wait_event_interruptible_timeout() returning -ERESTARTSYS
correctly. So I'm unable to draft and submit a patch here.


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/