Re: [PATCH RFC 2/3] usb: twl6030: fix the error check for omap_usb2_set_comparator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

On 13-09-2012 18:56, ABRAHAM, KISHON VIJAY wrote:

The function omap_usb2_set_comparator may return -ENODEV.
Use a signed variable to store and check so that the value
is not wrongly interpreted as a large positive number.
While at it lets use the err variable to do the same.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@xxxxxx>
---
untested

  drivers/usb/otg/twl6030-usb.c |    5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index fcadef7..11c22f3 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
[...]
@@ -331,8 +330,8 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
         twl->comparator.set_vbus        = twl6030_set_vbus;
         twl->comparator.start_srp       = twl6030_start_srp;

-       ret = omap_usb2_set_comparator(&twl->comparator);
-       if (ret == -ENODEV) {
+       err = omap_usb2_set_comparator(&twl->comparator);
+       if (err == -ENODEV) {

While at that can you just change the above to use IS_ERR?

   IS_ERR() operates on pointers, not on integers. You probably meant:

	if (err < 0)

WBR, Sergei

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux