From: Aaro Koskinen Date: Sat, 21 Dec 2013 18:37:36 +0000 (+0200) Subject: usb: phy: tahvo: fix smatch warnings X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=80f46d5dcb0af46f325c897392baef4911f401b7;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git usb: phy: tahvo: fix smatch warnings phy-tahvo introduced the following smatch warnings: drivers/usb/phy/phy-tahvo.c:203 tahvo_usb_set_host() warn: variable dereferenced before check 'otg' (see line 199) drivers/usb/phy/phy-tahvo.c:235 tahvo_usb_set_peripheral() warn: variable dereferenced before check 'otg' (see line 231) Fix by deleting bogus NULL pointer checks. The USB framework will always call us with a valid OTG pointer. Reported-by: Dan Carpenter Signed-off-by: Aaro Koskinen Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c index 8bb833e22d64..cc61ee44b911 100644 --- a/drivers/usb/phy/phy-tahvo.c +++ b/drivers/usb/phy/phy-tahvo.c @@ -200,9 +200,6 @@ static int tahvo_usb_set_host(struct usb_otg *otg, struct usb_bus *host) dev_dbg(&tu->pt_dev->dev, "%s %p\n", __func__, host); - if (otg == NULL) - return -ENODEV; - mutex_lock(&tu->serialize); if (host == NULL) { @@ -232,9 +229,6 @@ static int tahvo_usb_set_peripheral(struct usb_otg *otg, dev_dbg(&tu->pt_dev->dev, "%s %p\n", __func__, gadget); - if (!otg) - return -ENODEV; - mutex_lock(&tu->serialize); if (!gadget) {