Received: by 10.192.165.156 with SMTP id m28csp1122033imm; Wed, 11 Apr 2018 12:51:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+EwYpB/K4gkvkxnZ8KVAgPQQEw5kWV6nDPrfDxMnIAba7wacTCpzlRI6aVcMkqpxKf6q00 X-Received: by 10.99.167.75 with SMTP id w11mr3073981pgo.351.1523476311683; Wed, 11 Apr 2018 12:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523476311; cv=none; d=google.com; s=arc-20160816; b=g89143tWSyJvIVcmE4vZ+fM75EOnZUMCX0aI8KxxpK2BhTNY/Utk03UW+w+Ufc/9Pv nuCYwtGy1BBexODZGVoovZwI4rpL1A1NgJNle7hViNWRmU9WPEE5lw/IHnNTSqx/4nvy pP60iFydpXB2s3DA8yKDVSwlzoj4FXFj8+5IgW1P3zKNHbvTuOJ7GZfZyZKWLgTAarX+ +rr9o54+P6ffIt1o1YfU5RHf49j5eXL4Lw+nE9figKMyOI6RV95CEKo3+Wdfiu1NVEUt tM/UCjoT2pT/1sNVaClMVb//Mv1rklJpoTWw7jHiQFkMk3tiH7nhoeBN3YoEAH2lHLXG kuAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=aOp/T1vF9Efv/p1xSLFal++Z/DcLT4kE3fpLemBYPFo=; b=fYDIzEIlEssRLeMr7MJKXqGSQ1q3vEc3+ZzaUXXKvxEgBL7swee/JQOWh64gJiDZG1 KQYwZjgGQVQoSSUiaXHWZuI0TF+WWmVfvJ6S7hdtSDa0NehAd5Ho+rDidB0l2BZQYD26 2wzE5B1MyHe5MuHdHbU3WgewgjhAtmoLMnJiL/CDVr4EMq4pzj0rwW+sRuTl593nqjfq DmGAY4dZHuwTTNCUy/Zcozph3MnxjZ3kFrrDdWGMHQWYw9RxJFz7xOJzZ+k5TiMRKouC 2ZOHceiCNJBINTGrjhfVflbFX6r3pWWEBDu8svmW5mGO/3dge/DfLwI9gOCVb5qZX0VG seNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12-v6si88725pln.103.2018.04.11.12.51.14; Wed, 11 Apr 2018 12:51:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934124AbeDKS7f (ORCPT + 99 others); Wed, 11 Apr 2018 14:59:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37438 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932894AbeDKS7d (ORCPT ); Wed, 11 Apr 2018 14:59:33 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7EE90C3C; Wed, 11 Apr 2018 18:59:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arvind Yadav , Vinod Koul , Sasha Levin Subject: [PATCH 4.9 154/310] dmaengine: imx-sdma: Handle return value of clk_prepare_enable Date: Wed, 11 Apr 2018 20:34:53 +0200 Message-Id: <20180411183629.045699949@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arvind Yadav [ Upstream commit fb9caf370f4d0457789d13a1a1b110a8db846e5e ] clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/dma/imx-sdma.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1755,19 +1755,26 @@ static int sdma_probe(struct platform_de if (IS_ERR(sdma->clk_ahb)) return PTR_ERR(sdma->clk_ahb); - clk_prepare(sdma->clk_ipg); - clk_prepare(sdma->clk_ahb); + ret = clk_prepare(sdma->clk_ipg); + if (ret) + return ret; + + ret = clk_prepare(sdma->clk_ahb); + if (ret) + goto err_clk; ret = devm_request_irq(&pdev->dev, irq, sdma_int_handler, 0, "sdma", sdma); if (ret) - return ret; + goto err_irq; sdma->irq = irq; sdma->script_addrs = kzalloc(sizeof(*sdma->script_addrs), GFP_KERNEL); - if (!sdma->script_addrs) - return -ENOMEM; + if (!sdma->script_addrs) { + ret = -ENOMEM; + goto err_irq; + } /* initially no scripts available */ saddr_arr = (s32 *)sdma->script_addrs; @@ -1882,6 +1889,10 @@ err_register: dma_async_device_unregister(&sdma->dma_device); err_init: kfree(sdma->script_addrs); +err_irq: + clk_unprepare(sdma->clk_ahb); +err_clk: + clk_unprepare(sdma->clk_ipg); return ret; } @@ -1893,6 +1904,8 @@ static int sdma_remove(struct platform_d devm_free_irq(&pdev->dev, sdma->irq, sdma); dma_async_device_unregister(&sdma->dma_device); kfree(sdma->script_addrs); + clk_unprepare(sdma->clk_ahb); + clk_unprepare(sdma->clk_ipg); /* Kill the tasklet */ for (i = 0; i < MAX_DMA_CHANNELS; i++) { struct sdma_channel *sdmac = &sdma->channel[i];