Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752088AbdFNJvU (ORCPT ); Wed, 14 Jun 2017 05:51:20 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33220 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751816AbdFNJuk (ORCPT ); Wed, 14 Jun 2017 05:50:40 -0400 From: Arvind Yadav To: gregkh@linuxfoundation.org, felipe.balbi@linux.intel.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: gadget: mv_udc: Handle return value of clk_prepare_enable. Date: Wed, 14 Jun 2017 15:20:08 +0530 Message-Id: <9b131908790f9c4d8e2a8bd88f0054b2d433f78b.1497420817.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1126 Lines: 37 clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- drivers/usb/gadget/udc/mv_udc_core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c index 76f56c5..8a708d0 100644 --- a/drivers/usb/gadget/udc/mv_udc_core.c +++ b/drivers/usb/gadget/udc/mv_udc_core.c @@ -960,9 +960,9 @@ static int mv_ep_set_wedge(struct usb_ep *_ep) .fifo_flush = mv_ep_fifo_flush, /* flush fifo */ }; -static void udc_clock_enable(struct mv_udc *udc) +static int udc_clock_enable(struct mv_udc *udc) { - clk_prepare_enable(udc->clk); + return clk_prepare_enable(udc->clk); } static void udc_clock_disable(struct mv_udc *udc) @@ -1070,7 +1070,10 @@ static int mv_udc_enable_internal(struct mv_udc *udc) return 0; dev_dbg(&udc->dev->dev, "enable udc\n"); - udc_clock_enable(udc); + retval = udc_clock_enable(udc); + if (retval) + return retval; + if (udc->pdata->phy_init) { retval = udc->pdata->phy_init(udc->phy_regs); if (retval) { -- 1.9.1