wireless: rtl8187: replace udev with usb_get_dev()
Subsystems (3)
PATCH 1/1 wireless: rtl8187: replace udev with usb_get_dev()
Replace udev with usb_get_dev() in order to make code cleaner.
--- drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +1 -3
@@ -1455,9 +1455,7 @@ static int rtl8187_probe(struct usb_interface *intf,SET_IEEE80211_DEV (dev, &intf->dev);usb_set_intfdata (intf, dev); - priv->udev = udev; - -usb_get_dev (udev); + priv->udev =usb_get_dev (udev);skb_queue_head_init (&priv->rx_queue);
Signature · 1 line
2.25.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 25 lines · Hin-Tak Leung
Quoted 19 lines · Salah Triki
Replace udev with
usb_get_dev()in order to make code cleaner.Signed-off-by Salah Triki <[email protected]>---
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c| 4 +---1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +1
-3@@ -1455,9 +1455,7 @@ static int rtl8187_probe(struct usb_interface *intf, SET_IEEE80211_DEV(dev, &intf->dev); usb_set_intfdata(intf, dev); - priv->udev = udev; - - usb_get_dev(udev); + priv->udev = usb_get_dev(udev);
Quoted 7 lines
Quoted 4 lines
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +0
-0skb_queue_head_init(&priv->rx_queue);Signature · 1 line
2.25.1It is not cleaner - the change is not functionally equivalent. Before the change, the reference count is increased after the assignment; and after the change, before the assignment. So my question is, does the reference count increasing a little earlier matters? What can go wrong between very short time where the reference count increases, and
priv->udevnot yet assigned? I think there might be a race condition where the probbe function is called very shortly twice. Especially if the time of running the reference count function is non-trivial.
Probe functions are called in order, this should not be an issue.
This patch changes nothing, I do not think it is needed at all.
thanks,
greg k-h
Quoted 28 lines · Hin-Tak Leung
Review
Quoted 8 lines · Salah Triki
Replace udev with
usb_get_dev()in order to make code cleaner.Signed-off-by Salah Triki <[email protected]>---
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c| 4 +---1 file changed, 1 insertion(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.cQuoted 13 lines
index
eb68b2d3caa1..30bb3c2b8407100644drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +1
-3@@ -1455,9 +1455,7 @@ static int rtl8187_probe(struct usb_interface *intf, SET_IEEE80211_DEV(dev, &intf->dev); usb_set_intfdata(intf, dev); - priv->udev = udev; - - usb_get_dev(udev); + priv->udev = usb_get_dev(udev); skb_queue_head_init(&priv->rx_queue);
Quoted 7 lines
Quoted 2 lines
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +0
-1--2.25.1
It is not cleaner - the change is not functionally equivalent. Before the change, the reference count is increased after the assignment; and after the change, before the assignment. So my question is, does the reference count increasing a little earlier matters? What can go wrong between very short time where the reference count increases, and
priv->udevnot yet assigned? I think there might be a race condition where the probbe function is called very shortly twice. Especially if the time of running the reference count function is non-trivial.Larry, what do you think?
My belief was that probe routines were called in order, which was confirmed by GregKH. As a result, there can be no race condition, and the order of setting the reference count does not matter. On the other hand, the current code is not misleading, nor unclear. Why should it be changed?
NACK on the patch.
Larry
Quoted 37 lines · Hin-Tak Leung
Review
Quoted 8 lines · Salah Triki
Replace udev with
usb_get_dev()in order to make code cleaner.Signed-off-by Salah Triki <[email protected]>---
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c| 4 +---1 file changed, 1 insertion(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.cQuoted 16 lines
index
eb68b2d3caa1..30bb3c2b8407100644drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +1
-3@@ -1455,9 +1455,7 @@ static int rtl8187_probe(struct usb_interface *intf,SET_IEEE80211_DEV (dev, &intf->dev);usb_set_intfdata (intf, dev); - priv->udev = udev; - -usb_get_dev (udev); + priv->udev =usb_get_dev (udev);skb_queue_head_init (&priv->rx_queue);Signature · 1 line
2.25.1It is not cleaner - the change is not functionally equivalent. Before the change, the reference count is increased after the assignment; and after the change, before the assignment. So my question is, does the reference count increasing a little earlier matters? What can go wrong between very short time where the reference count increases, and
priv->udevnot yet assigned? I think there might be a race condition where the probbe function is called very shortly twice. Especially if the time of running the reference count function is non-trivial.
Quoted 1 line
Larry, what do you think?
BTW, please don't use HTML in emails. Our lists drop all HTML mail (and for a good reason).
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches