Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753927AbdF1Ew1 (ORCPT ); Wed, 28 Jun 2017 00:52:27 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36550 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751581AbdF1EwS (ORCPT ); Wed, 28 Jun 2017 00:52:18 -0400 From: Arvind Yadav To: stern@rowland.harvard.edu, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5] usb: host: ohci-pxa27x: Handle return value of clk_prepare_enable Date: Wed, 28 Jun 2017 10:21:28 +0530 Message-Id: <44a351535e854fa67bdbfe6fb84ce070b79758ec.1498625250.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: 1421 Lines: 51 clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- Changes in v4: Change log was missing. Changes in v3: Change log correction. Added change log below '---'. Changes in v2: Remove useless initialization of retval. drivers/usb/host/ohci-pxa27x.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 79efde8f..21c010f 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -274,14 +274,16 @@ static inline void pxa27x_reset_hc(struct pxa27x_ohci *pxa_ohci) static int pxa27x_start_hc(struct pxa27x_ohci *pxa_ohci, struct device *dev) { - int retval = 0; + int retval; struct pxaohci_platform_data *inf; uint32_t uhchr; struct usb_hcd *hcd = dev_get_drvdata(dev); inf = dev_get_platdata(dev); - clk_prepare_enable(pxa_ohci->clk); + retval = clk_prepare_enable(pxa_ohci->clk); + if (retval) + return retval; pxa27x_reset_hc(pxa_ohci); @@ -296,8 +298,10 @@ static int pxa27x_start_hc(struct pxa27x_ohci *pxa_ohci, struct device *dev) if (inf->init) retval = inf->init(dev); - if (retval < 0) + if (retval < 0) { + clk_disable_unprepare(pxa_ohci->clk); return retval; + } if (cpu_is_pxa3xx()) pxa3xx_u2d_start_hc(&hcd->self); -- 1.9.1