From: Manish Narani <manish.narani@xilinx.com>
To: <peter.chen@kernel.org>, <gregkh@linuxfoundation.org>,
<michal.simek@xilinx.com>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<git@xilinx.com>, Piyush Mehta <piyush.mehta@xilinx.com>,
Manish Narani <manish.narani@xilinx.com>
Subject: [PATCH 4/6] usb: chipidea: Fix return value handling
Date: Tue, 24 Aug 2021 22:46:16 +0530 [thread overview]
Message-ID: <1629825378-8089-5-git-send-email-manish.narani@xilinx.com> (raw)
In-Reply-To: <1629825378-8089-1-git-send-email-manish.narani@xilinx.com>
From: Piyush Mehta <piyush.mehta@xilinx.com>
API was neither captured nor checked.Fixed it by capturing the
return value and then checking for any error.
Addresses-Coverity: "Calling without checking return"
Addresses-Coverity: "CHECKED_RETURN"
Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
Signed-off-by: Manish Narani <manish.narani@xilinx.com>
---
drivers/usb/chipidea/core.c | 11 +++++++----
drivers/usb/chipidea/otg.c | 6 +++++-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 2b18f50..676346f 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -700,13 +700,16 @@ static int ci_get_platdata(struct device *dev,
if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
- of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
- &platdata->phy_clkgate_delay_us);
+ if (of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
+ &platdata->phy_clkgate_delay_us))
+ dev_dbg(dev, "Missing phy-clkgate-delay-us property\n");
platdata->itc_setting = 1;
- of_property_read_u32(dev->of_node, "itc-setting",
- &platdata->itc_setting);
+ if (of_property_read_u32(dev->of_node, "itc-setting",
+ &platdata->itc_setting))
+ dev_dbg(dev, "Missing itc-setting property\n");
+
ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
&platdata->ahb_burst_config);
diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
index 8dd5928..d527d9d 100644
--- a/drivers/usb/chipidea/otg.c
+++ b/drivers/usb/chipidea/otg.c
@@ -168,6 +168,7 @@ static int hw_wait_vbus_lower_bsv(struct ci_hdrc *ci)
static void ci_handle_id_switch(struct ci_hdrc *ci)
{
enum ci_role role = ci_otg_role(ci);
+ int ret;
if (role != ci->role) {
dev_dbg(ci->dev, "switching from %s to %s\n",
@@ -193,7 +194,10 @@ static void ci_handle_id_switch(struct ci_hdrc *ci)
*/
hw_wait_vbus_lower_bsv(ci);
- ci_role_start(ci, role);
+ ret = ci_role_start(ci, role);
+ if (ret < 0)
+ dev_dbg(ci->dev, "switching err %d\n", ret);
+
/* vbus change may have already occurred */
if (role == CI_ROLE_GADGET)
ci_handle_vbus_change(ci);
--
2.1.1
next prev parent reply other threads:[~2021-08-24 17:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-24 17:16 [PATCH 0/6] Chipidea USB driver Enhancements and Bug Fixes Manish Narani
2021-08-24 17:16 ` [PATCH 1/6] usb: chipidea: Add support for VBUS control with PHY Manish Narani
2021-10-07 4:44 ` Peter Chen
2021-10-08 4:59 ` Jun Li
2021-08-24 17:16 ` [PATCH 2/6] usb: chipidea: Use usb2 phy for Zynq platform Manish Narani
2021-10-07 4:52 ` Peter Chen
2021-08-24 17:16 ` [PATCH 3/6] usb: chipidea: Check usb_phy exists before using it Manish Narani
2021-10-07 4:54 ` Peter Chen
2021-08-24 17:16 ` Manish Narani [this message]
2021-08-24 17:16 ` [PATCH 5/6] usb: chipidea: core: Add return value function check Manish Narani
2021-10-07 5:00 ` Peter Chen
2021-08-24 17:16 ` [PATCH 6/6] usb: chipidea: udc: Add xilinx revision support Manish Narani
2021-10-07 5:02 ` Peter Chen
2021-10-07 5:03 ` Peter Chen
2021-10-07 5:12 ` [PATCH 0/6] Chipidea USB driver Enhancements and Bug Fixes Peter Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1629825378-8089-5-git-send-email-manish.narani@xilinx.com \
--to=manish.narani@xilinx.com \
--cc=git@xilinx.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=peter.chen@kernel.org \
--cc=piyush.mehta@xilinx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).