Skip to contentSkip to conversation

usb: gadget: m66592-udc: Add check for clk_enable()

PATCH In review Mingwei Zheng 2 participants 5 messages Dec 15, 2024 – Dec 26, 2024 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: m66592-udc: Add check for clk_enable()

Add check for the return value of clk_enable() to catch the potential error.

Fixes b4822e2317e8 ("usb: gadget: m66592-udc: Convert to use module_platform_driver()")
---
 drivers/usb/gadget/udc/m66592-udc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/m66592-udc.c +5 -1
index a938b2af0944..bf408476a24c 100644
@@ -1606,7 +1606,11 @@ static int m66592_probe(struct platform_device *pdev)
 			ret = PTR_ERR(m66592->clk);
 			goto clean_up2;
 		}
-		clk_enable(m66592->clk);
+		ret = clk_enable(m66592->clk);
+		if (ret) {
+			clk_put(m66592->clk);
+			goto clean_up2;
+		}
 	}
 
 	INIT_LIST_HEAD(&m66592->gadget.ep_list);
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 6 lines · Mingwei Zheng

Add check for the return value of clk_enable() to catch the potential error.

Fixes b4822e2317e8 ("usb: gadget: m66592-udc: Convert to use module_platform_driver()")

Why this order of signed-off-by lines? Shouldn't yours be last? Who wrote this patch?

Quoted 9 lines
---
 drivers/usb/gadget/udc/m66592-udc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/m66592-udc.c +0 -0
index a938b2af0944..bf408476a24c 100644

drivers/usb/gadget/udc/m66592-udc.c static int m66592_probe(struct platform_device *pdev) · line 1613

Quoted 9 lines
drivers/usb/gadget/udc/m66592-udc.c +5 -1
@@ -1606,7 +1606,11 @@ static int m66592_probe(struct platform_device *pdev)
 			ret = PTR_ERR(m66592->clk);
 			goto clean_up2;
 		}
-		clk_enable(m66592->clk);
+		ret = clk_enable(m66592->clk);
+		if (ret) {
+			clk_put(m66592->clk);
+			goto clean_up2;
+		}

How did you find this and how was it tested?

thanks,

greg k-h

#2 lore raw

Hi Greg,

Quoted 5 lines · Greg KH
Quoted 3 lines · Mingwei Zheng

Add check for the return value of clk_enable() to catch the potential error.

Quoted 7 lines
Quoted 3 lines
Fixes b4822e2317e8 ("usb: gadget: m66592-udc: Convert to use module_platform_driver()")

Why this order of signed-off-by lines? Shouldn't yours be last? Who wrote this patch?

I listed two names because both of us co-authored this patch.

Quoted 21 lines
Quoted 9 lines
---
 drivers/usb/gadget/udc/m66592-udc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/m66592-udc.c +0 -0
index a938b2af0944..bf408476a24c 100644

drivers/usb/gadget/udc/m66592-udc.c static int m66592_probe(struct platform_device *pdev) · line 1613

Quoted 9 lines
drivers/usb/gadget/udc/m66592-udc.c +5 -1
@@ -1606,7 +1606,11 @@ static int m66592_probe(struct platform_device *pdev)
                      ret = PTR_ERR(m66592->clk);
                      goto clean_up2;
              }
-             clk_enable(m66592->clk);
+             ret = clk_enable(m66592->clk);
+             if (ret) {
+                     clk_put(m66592->clk);
+                     goto clean_up2;
+             }

How did you find this and how was it tested?

Quoted 3 lines

thanks,

greg k-h

We found it through a static analysis tool. Additionally, we validated the patch's correctness
using the built-in tests provided during the compilation process. Please kindly let me know if you need further details or have any questions. Thank you!

Best,
Mingwei

maintainer
#3 lore raw
Quoted 39 lines · Mingwei Zheng

Hi Greg,

Quoted 5 lines · Greg KH
Quoted 3 lines · Mingwei Zheng

Add check for the return value of clk_enable() to catch the potential error.

Quoted 7 lines
Quoted 3 lines
Fixes b4822e2317e8 ("usb: gadget: m66592-udc: Convert to use module_platform_driver()")

Why this order of signed-off-by lines? Shouldn't yours be last? Who wrote this patch?

I listed two names because both of us co-authored this patch.

Quoted 21 lines
Quoted 9 lines
---
 drivers/usb/gadget/udc/m66592-udc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/m66592-udc.c +0 -0
index a938b2af0944..bf408476a24c 100644

drivers/usb/gadget/udc/m66592-udc.c static int m66592_probe(struct platform_device *pdev) · line 1613

Quoted 9 lines
drivers/usb/gadget/udc/m66592-udc.c +5 -1
@@ -1606,7 +1606,11 @@ static int m66592_probe(struct platform_device *pdev)
                      ret = PTR_ERR(m66592->clk);
                      goto clean_up2;
              }
-             clk_enable(m66592->clk);
+             ret = clk_enable(m66592->clk);
+             if (ret) {
+                     clk_put(m66592->clk);
+                     goto clean_up2;
+             }

How did you find this and how was it tested?

Quoted 5 lines
Quoted 3 lines

thanks,

greg k-h

We found it through a static analysis tool.

Then you need to properly document that as our documentation says it is required, right?

thanks,

greg k-h

#4 lore raw

Hi Greg,

Quoted 45 lines · Greg KH
Quoted 43 lines · Mingwei Zheng

Hi Greg,

Quoted 5 lines · Greg KH
Quoted 3 lines · Mingwei Zheng

Add check for the return value of clk_enable() to catch the potential error.

Quoted 7 lines
Quoted 3 lines
Fixes b4822e2317e8 ("usb: gadget: m66592-udc: Convert to use module_platform_driver()")

Why this order of signed-off-by lines? Shouldn't yours be last? Who wrote this patch?

I listed two names because both of us co-authored this patch.

Quoted 24 lines
Quoted 9 lines
---
 drivers/usb/gadget/udc/m66592-udc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/m66592-udc.c +0 -0
index a938b2af0944..bf408476a24c 100644

drivers/usb/gadget/udc/m66592-udc.c static int m66592_probe(struct platform_device *pdev) · line 1613

Quoted 9 lines
drivers/usb/gadget/udc/m66592-udc.c +5 -1
@@ -1606,7 +1606,11 @@ static int m66592_probe(struct platform_device *pdev)
                      ret = PTR_ERR(m66592->clk);
                      goto clean_up2;
              }
-             clk_enable(m66592->clk);
+             ret = clk_enable(m66592->clk);
+             if (ret) {
+                     clk_put(m66592->clk);
+                     goto clean_up2;
+             }

How did you find this and how was it tested?

thanks,

greg k-h

Quoted 8 lines
Quoted 1 line

We found it through a static analysis tool.

Then you need to properly document that as our documentation says it is required, right?

thanks,

greg k-h

I send a PATCH v2 specifying the tool name in the commit msg for
your review. Thank you so much for your suggestion!

Best,
Mingwei