public inbox for linux-rockchip@lists.infradead.org
 help / color / mirror / Atom feed
* [bug report] phy: rockchip-inno-usb2: support otg-port for rk3399
@ 2016-11-17 11:04 Dan Carpenter
  2016-11-22  9:16 ` wlf
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-11-17 11:04 UTC (permalink / raw)
  To: wulf-TNX95d0MmH7DzftRWevZcw
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hello William Wu,

The patch 0c42fe48fd23: "phy: rockchip-inno-usb2: support otg-port
for rk3399" from Nov 7, 2016, leads to the following static checker
warning:

	drivers/phy/phy-rockchip-inno-usb2.c:998 rockchip_usb2phy_otg_port_init()
	warn: 'rphy->edev' isn't an ERR_PTR

drivers/phy/phy-rockchip-inno-usb2.c
   989          ret = devm_request_threaded_irq(rphy->dev, rport->bvalid_irq, NULL,
   990                                          rockchip_usb2phy_bvalid_irq,
   991                                          IRQF_ONESHOT,
   992                                          "rockchip_usb2phy_bvalid", rport);
   993          if (ret) {
   994                  dev_err(rphy->dev, "failed to request otg-bvalid irq handle\n");
   995                  goto out;
   996          }
   997  
   998          if (!IS_ERR(rphy->edev)) {

I think the static checker is correct that this check should be removed.
The rest of the code assumes ->edev is a valid pointer.

   999                  rport->event_nb.notifier_call = rockchip_otg_event;
  1000  
  1001                  ret = extcon_register_notifier(rphy->edev, EXTCON_USB_HOST,
  1002                                                 &rport->event_nb);
  1003                  if (ret)
  1004                          dev_err(rphy->dev, "register USB HOST notifier failed\n");
  1005          }
  1006  
  1007  out:
  1008          return ret;
  1009  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] phy: rockchip-inno-usb2: support otg-port for rk3399
  2016-11-17 11:04 [bug report] phy: rockchip-inno-usb2: support otg-port for rk3399 Dan Carpenter
@ 2016-11-22  9:16 ` wlf
       [not found]   ` <81fc5933-7bee-2d83-f8ef-a951355c4248-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: wlf @ 2016-11-22  9:16 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Dear Dan,

在 2016年11月17日 19:04, Dan Carpenter 写道:
> Hello William Wu,
>
> The patch 0c42fe48fd23: "phy: rockchip-inno-usb2: support otg-port
> for rk3399" from Nov 7, 2016, leads to the following static checker
> warning:
>
> 	drivers/phy/phy-rockchip-inno-usb2.c:998 rockchip_usb2phy_otg_port_init()
> 	warn: 'rphy->edev' isn't an ERR_PTR
>
> drivers/phy/phy-rockchip-inno-usb2.c
>     989          ret = devm_request_threaded_irq(rphy->dev, rport->bvalid_irq, NULL,
>     990                                          rockchip_usb2phy_bvalid_irq,
>     991                                          IRQF_ONESHOT,
>     992                                          "rockchip_usb2phy_bvalid", rport);
>     993          if (ret) {
>     994                  dev_err(rphy->dev, "failed to request otg-bvalid irq handle\n");
>     995                  goto out;
>     996          }
>     997
>     998          if (!IS_ERR(rphy->edev)) {
>
> I think the static checker is correct that this check should be removed.
> The rest of the code assumes ->edev is a valid pointer.
Yes, you are right. This static checker can be removed safely.
Thanks very much for your help.

Best regards,
          wulf

>
>     999                  rport->event_nb.notifier_call = rockchip_otg_event;
>    1000
>    1001                  ret = extcon_register_notifier(rphy->edev, EXTCON_USB_HOST,
>    1002                                                 &rport->event_nb);
>    1003                  if (ret)
>    1004                          dev_err(rphy->dev, "register USB HOST notifier failed\n");
>    1005          }
>    1006
>    1007  out:
>    1008          return ret;
>    1009  }
>
> regards,
> dan carpenter
>
>
>



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [patch] phy: rockchip-inno-usb2: remove an unneeded check
       [not found]   ` <81fc5933-7bee-2d83-f8ef-a951355c4248-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2016-11-25 11:18     ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-11-25 11:18 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, wlf
  Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Heiko Stuebner

"rphy->edev" can't be an error pointer so we can remove the check and
pull the code in an indent level.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

diff --git a/drivers/phy/phy-rockchip-inno-usb2.c b/drivers/phy/phy-rockchip-inno-usb2.c
index 2f99ec9..7494210 100644
--- a/drivers/phy/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/phy-rockchip-inno-usb2.c
@@ -995,14 +995,11 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
 		goto out;
 	}
 
-	if (!IS_ERR(rphy->edev)) {
-		rport->event_nb.notifier_call = rockchip_otg_event;
-
-		ret = extcon_register_notifier(rphy->edev, EXTCON_USB_HOST,
-					       &rport->event_nb);
-		if (ret)
-			dev_err(rphy->dev, "register USB HOST notifier failed\n");
-	}
+	rport->event_nb.notifier_call = rockchip_otg_event;
+	ret = extcon_register_notifier(rphy->edev, EXTCON_USB_HOST,
+				       &rport->event_nb);
+	if (ret)
+		dev_err(rphy->dev, "register USB HOST notifier failed\n");
 
 out:
 	return ret;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-25 11:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-17 11:04 [bug report] phy: rockchip-inno-usb2: support otg-port for rk3399 Dan Carpenter
2016-11-22  9:16 ` wlf
     [not found]   ` <81fc5933-7bee-2d83-f8ef-a951355c4248-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-11-25 11:18     ` [patch] phy: rockchip-inno-usb2: remove an unneeded check Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox