Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp637626pxb; Thu, 23 Sep 2021 07:41:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6NukipjpB87BvEZ/qPDB5/qPA4vXoeebKDopmHUciByE247Vd4lVQeMENY4K7LN24Vdm1 X-Received: by 2002:a92:dc02:: with SMTP id t2mr3890541iln.126.1632408100724; Thu, 23 Sep 2021 07:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632408100; cv=none; d=google.com; s=arc-20160816; b=d8o2A1K7v5rtqWe5y4nN48HsWEyRhkhLAw4ku+lAebcllPLG8vtapqglTKYPHK4Mzz tW3y9zmjTFAd6ohu8UlYTF3OEP+0nqSrwqKuXMvZpCpMgNR+4dzs7CMDC+kO42gvcYOE OhmQEOU4hVSxyKG2wPUhpnZl3UD+miQrSzhDoOafcJy9tzZfh7M5cb/4FesyZKwpufb6 oU75NPZrhYPCR4a4oJnbhBCAMK7AVa72+L5VrlxhlTwEyCjmsiwL/0IDLtyDvdU91P2r hjd2FrOEre2obLWrnrUc3bMbKdLupURQB3RP+0BsFVmPfSYPmQUoGtQ5ud8m67KFv8HB F3lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=xW2wAkvZp34nKEIFeiT3X1cTvPkeKAiajF91gj2k9xk=; b=b00QLYFHbBe9Xeg5BMdpSmujeLPYjG8dwvoZJCYMLJCrpFZgkwJynonTYD70cFduBw i+sUYKDm9NNstQvrNUdv/+KmlxKcbsWBJzw9WrUrzLHzc0iT3uH92htkp+3u6YMSuIB1 zt+ba0E1QDCTk14U2QFPn9CI9SC6wDvFlw5FPk6fVkdDG+Tyo8GMaNLB7VAgsU7rOjyq XwfPjuzkkaUUl/4JWIaQQDdzarQWgVIJqPa1huz3+UZxl4n65ppZYFIwLLJDyNdjriN7 0p9y0wAuwewCBltmwUZC1OxzmHPUWQ+T5d97vJJhifs648/TYX+CYJReQZlXl+qTQkV7 LDBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s9si8416054ilu.57.2021.09.23.07.41.28; Thu, 23 Sep 2021 07:41:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241698AbhIWOmI (ORCPT + 99 others); Thu, 23 Sep 2021 10:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241710AbhIWOmH (ORCPT ); Thu, 23 Sep 2021 10:42:07 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C518CC061756 for ; Thu, 23 Sep 2021 07:40:35 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mTPti-0001xl-9G; Thu, 23 Sep 2021 16:40:26 +0200 Received: from mtr by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mTPth-0001lR-0r; Thu, 23 Sep 2021 16:40:25 +0200 Date: Thu, 23 Sep 2021 16:40:25 +0200 From: Michael Tretter To: Harini Katakam Cc: vkoul@kernel.org, romain.perier@gmail.com, allen.lkml@gmail.com, yukuai3@huawei.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, harinikatakamlinux@gmail.com, michal.simek@xilinx.com, radhey.shyam.pandey@xilinx.com, shravya.kumbham@xilinx.com, kernel@pengutronix.de Subject: Re: [PATCH 3/4] dmaengine: zynqmp_dma: Add conditions for return value check Message-ID: <20210923144025.GC30905@pengutronix.de> References: <20210914082817.22311-1-harini.katakam@xilinx.com> <20210914082817.22311-4-harini.katakam@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210914082817.22311-4-harini.katakam@xilinx.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 16:32:19 up 217 days, 17:56, 113 users, load average: 0.19, 0.24, 0.20 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: mtr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 14 Sep 2021 13:58:16 +0530, Harini Katakam wrote: > From: Shravya Kumbham > > Add condition to check the return value of dma_async_device_register > and pm_runtime_get_sync functions. > > Addresses-Coverity: Event check_return. > Signed-off-by: Shravya Kumbham > Reviewed-by: Radhey Shyam Pandey > --- > drivers/dma/xilinx/zynqmp_dma.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c > index d28b9ffb4309..588460e56ab8 100644 > --- a/drivers/dma/xilinx/zynqmp_dma.c > +++ b/drivers/dma/xilinx/zynqmp_dma.c > @@ -1080,7 +1080,11 @@ static int zynqmp_dma_probe(struct platform_device *pdev) > pm_runtime_set_autosuspend_delay(zdev->dev, ZDMA_PM_TIMEOUT); > pm_runtime_use_autosuspend(zdev->dev); > pm_runtime_enable(zdev->dev); > - pm_runtime_get_sync(zdev->dev); > + ret = pm_runtime_get_sync(zdev->dev); > + if (ret < 0) { > + dev_err(zdev->dev, "pm_runtime_get_sync() failed\n"); > + pm_runtime_disable(zdev->dev); > + } Thanks for the patch. You need to call pm_runtime_put() on the error path. Or you could use pm_runtime_resume_and_get(), which does this automatically. I am wondering, if it wouldn't be cleaner to make this dependent on pm_runtime_enabled() and avoiding pm_runtime_disable() on the error path altogether. Michael > if (!pm_runtime_enabled(zdev->dev)) { > ret = zynqmp_dma_runtime_resume(zdev->dev); > if (ret) > @@ -1096,7 +1100,11 @@ static int zynqmp_dma_probe(struct platform_device *pdev) > p->dst_addr_widths = BIT(zdev->chan->bus_width / 8); > p->src_addr_widths = BIT(zdev->chan->bus_width / 8); > > - dma_async_device_register(&zdev->common); > + ret = dma_async_device_register(&zdev->common); > + if (ret) { > + dev_err(zdev->dev, "failed to register the dma device\n"); > + goto free_chan_resources; > + } > > ret = of_dma_controller_register(pdev->dev.of_node, > of_zynqmp_dma_xlate, zdev); > -- > 2.17.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >