Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4601012pxj; Wed, 12 May 2021 09:01:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7QMElOOXlC4mByVgJe2nLKJsvz6aDAw+7wtNi6owGzRuWxFHJ2WNDM47M7ICQZe4TArLI X-Received: by 2002:a17:907:10d4:: with SMTP id rv20mr38418513ejb.301.1620835315899; Wed, 12 May 2021 09:01:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835315; cv=none; d=google.com; s=arc-20160816; b=GMJ5noxtaTt1OpDv4PNIjCqiLATaq4NyuvBcZYMdExAaHsozbhsOQAB7f1k4PWCi+r haRFi0cy4VOc4zMoFaoe+7rl4du7SPdif2cmKhQbtd82Zk8lYyYVd/nBJ062fmE7hb03 bzTxae7qg/8/rkJkiJBRQLUxE8lxTD339fxOpJ2DB77p2N0lsb+UYLHsGQSkNvbanKJV fxgBgSbV+aLuPaRVbVupzYpIINPVN570PPXfzqLA2RIHNV+FV0+74bOWAgcNvdwsPsF3 06+dsBNavMitHa6C6qerLuvgjc0nuzijY8r3TEpxke+1H1Cvv8gr9vj6TfqiMmqKuE6K IlEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u/BlhzqmdWB/25zmUAmiEjtTtawnHkfbs2CpdOAwTCc=; b=y8cfd9N7Ed4H8yOYsdIbwqdRUgj1J+X/nzDYXeVudmapbdZUIw/YqPWMbc2lSl2Aq7 UThnBRNfavxHaAac0khW/O2f5CH6EVIOYYeh3EP80RVDp5E8yMXJRG9mWrLQMysDvfr8 FyLz5Ap3p80aM7zkPp0Uv6eYi9t+BkN5Dk8JaWUjdPCyP0GLyieJsy4RsuOgNjUSVJyh E2J9LP+Su2RutGcOUtO/08CHdh0MUanFq7O8MnjjHJn59ZcXW2sJEZ4mXdo0G/VQraT9 4KmLoJafhK15+iQXaAu1crYulqxwNqgE0XYLFldfO7vNdzPFKBju8uZDPjG8kA2G/cbc O7bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LG3ooePn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si112705edu.41.2021.05.12.09.01.26; Wed, 12 May 2021 09:01:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LG3ooePn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236429AbhELPzJ (ORCPT + 99 others); Wed, 12 May 2021 11:55:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:40754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235073AbhELP0j (ORCPT ); Wed, 12 May 2021 11:26:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0FB62619E6; Wed, 12 May 2021 15:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832288; bh=lGBwzYM6UPRK04oz/BIx4ywRA0Ft18OoVzFBSvPbXa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LG3ooePnZc9clYsh/fXc6oVj7nzk4DFb7CgELwjAGgBcrrQtKsB54LGzRyqPu9nai Vwihv/WENKrv38HiozAuwD14EKN9rbLEiq5EU/OEQMzQMw9gZyALpcEOlygG7Ra4bf upipv1gosMBEN4juwj3HpXUmH5LqINFDWnacS5/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.10 183/530] usb: gadget: s3c: Fix the error handling path in s3c2410_udc_probe() Date: Wed, 12 May 2021 16:44:53 +0200 Message-Id: <20210512144825.855562227@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit e5242861ec6a0bce25b4cd10af0fc8a508fd067d ] Some 'clk_prepare_enable()' and 'clk_get()' must be undone in the error handling path of the probe function, as already done in the remove function. Fixes: 3fc154b6b813 ("USB Gadget driver for Samsung s3c2410 ARM SoC") Signed-off-by: Christophe JAILLET Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/2bee52e4ce968f48b4c32545cf8f3b2ab825ba82.1616830026.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/udc/s3c2410_udc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c index b81979b3bdb6..b154b62abefa 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.c +++ b/drivers/usb/gadget/udc/s3c2410_udc.c @@ -1750,7 +1750,8 @@ static int s3c2410_udc_probe(struct platform_device *pdev) udc_clock = clk_get(NULL, "usb-device"); if (IS_ERR(udc_clock)) { dev_err(dev, "failed to get udc clock source\n"); - return PTR_ERR(udc_clock); + retval = PTR_ERR(udc_clock); + goto err_usb_bus_clk; } clk_prepare_enable(udc_clock); @@ -1773,7 +1774,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev) base_addr = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base_addr)) { retval = PTR_ERR(base_addr); - goto err; + goto err_udc_clk; } the_controller = udc; @@ -1791,7 +1792,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev) if (retval != 0) { dev_err(dev, "cannot get irq %i, err %d\n", irq_usbd, retval); retval = -EBUSY; - goto err; + goto err_udc_clk; } dev_dbg(dev, "got irq %i\n", irq_usbd); @@ -1862,7 +1863,14 @@ err_gpio_claim: gpio_free(udc_info->vbus_pin); err_int: free_irq(irq_usbd, udc); -err: +err_udc_clk: + clk_disable_unprepare(udc_clock); + clk_put(udc_clock); + udc_clock = NULL; +err_usb_bus_clk: + clk_disable_unprepare(usb_bus_clock); + clk_put(usb_bus_clock); + usb_bus_clock = NULL; return retval; } -- 2.30.2