提交 63a13079 编写于 作者: C Cesar Eduardo Barros 提交者: Felipe Balbi

usb: phy: mv-otg: use to_delayed_work instead of cast

Directly casting a work_struct pointer to a delayed_work is risky if the
work member of struct delayed_work is ever moved from being the first
member.

Instead, use the inline function to_delayed_work(), which does the same
cast in a safer way (using container_of).
Signed-off-by: NCesar Eduardo Barros <cesarb@cesarb.net>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 b2e587db
......@@ -420,7 +420,7 @@ static void mv_otg_work(struct work_struct *work)
struct usb_otg *otg;
int old_state;
mvotg = container_of((struct delayed_work *)work, struct mv_otg, work);
mvotg = container_of(to_delayed_work(work), struct mv_otg, work);
run:
/* work queue is single thread, or we need spin_lock to protect */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册