Skip to contentSkip to conversation

usb: Assign NULL ​​to phy that may be returned

PATCH In review Wang Qing 2 participants 3 messages Nov 6, 2020 USB

lore
Share & tools
lore

Wang Qing

author
#0 lore raw

PATCH 1/1 usb: Assign NULL ​​to phy that may be returned

Assign initial values ​​to local variables that may be returned

---
 drivers/usb/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/phy/phy.c +1 -1
index b47285f..de21967
@@ -59,7 +59,7 @@ static struct usb_phy *__usb_find_phy(struct list_head *list,
 
 static struct usb_phy *__of_usb_find_phy(struct device_node *node)
 {
-	struct usb_phy  *phy;
+	struct usb_phy  *phy = NULL;
 
 	if (!of_device_is_available(node))
 		return ERR_PTR(-ENODEV);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 3 lines · Wang Qing

Assign initial values ​​to local variables that may be returned

Your subject, and body of text, seem to have 2 "odd" characters in it, please fix up.

Also, your subject and changelog body here are identical, please be much more verbose in the body explaining why you are doing something, not just what you are doing.

And your subject line should also match other patches for this file, and have "usb: phy: ..." in the beginning.

Quoted 9 lines
---
 drivers/usb/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/phy/phy.c +0 -0
index b47285f..de21967

drivers/usb/phy/phy.c static struct usb_phy *__usb_find_phy(struct list_head *list, · line 62

Quoted 5 lines
drivers/usb/phy/phy.c +1 -1
@@ -59,7 +59,7 @@ static struct usb_phy *__usb_find_phy(struct list_head *list,
 
 static struct usb_phy *__of_usb_find_phy(struct device_node *node)
 {
-	struct usb_phy  *phy;
+	struct usb_phy  *phy = NULL;

Why isn't the compiler complaining about this today? Are you sure this is needed?

thanks,

greg k-h

author
#2 lore raw
Quoted 7 lines
Quoted 3 lines

Assign initial values to local variables that may be returned

Your subject, and body of text, seem to have 2 "odd" characters in it, please fix up.

Quoted 6 lines

Also, your subject and changelog body here are identical, please be much more verbose in the body explaining why you are doing something, not just what you are doing.

And your subject line should also match other patches for this file, and have "usb: phy: ..." in the beginning.

Yeah, I got it.

Quoted 11 lines
Quoted 11 lines
---
 drivers/usb/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/phy/phy.c +0 -0
index b47285f..de21967
@@ -59,7 +59,7 @@ static struct usb_phy *__usb_find_phy(struct list_head *list,
 
Quoted 7 lines

drivers/usb/phy/phy.c static struct usb_phy *__usb_find_phy(struct list_head *list, · line 62

Quoted 4 lines
drivers/usb/phy/phy.c +1 -1
 static struct usb_phy *__of_usb_find_phy(struct device_node *node)
 {
-	struct usb_phy  *phy;
+	struct usb_phy  *phy = NULL;

Why isn't the compiler complaining about this today? Are you sure this is needed?

Sorry, I didn't look at it carefully, because __usb_find_phy has an initial value, and I was affected.. You don't need to modify it, In fact.

thanks,

Wang Qing

Quoted 4 lines

thanks,

greg k-h