From patchwork Tue Oct 25 09:02:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10611 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp892150wru; Tue, 25 Oct 2022 02:08:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WK7p1y9ajHEHDNT3J6zfnnT2+7lOkZRE/Nccemu7/irWX/0kCp0JhdMdPXrl4OSkP3PN5 X-Received: by 2002:a17:906:8470:b0:78d:b531:7d10 with SMTP id hx16-20020a170906847000b0078db5317d10mr31840138ejc.275.1666688910865; Tue, 25 Oct 2022 02:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666688910; cv=none; d=google.com; s=arc-20160816; b=Rpw5TLrx6bRbYwDrTatl4q3H3JnQn0SC+8yT2uYnQzuR5MtCUmvr+YJWTWtF6LixD4 ImrWgXoPWA82uUG7prg6GATxr2WX1NXnipGgMVjjUuUnzL8QAXrs0Nl5AabcdbxF6qAG pQRAdw45U2IuAEW2D1ai4GH3JqrVyZgxxIn/c4JxfgRc1vc2IVqymxAJAM2rMWahCfg5 6XVVtQ6vs9qtJR0BlDU93WwqspI5WgqL66AFfINs7w6LqOzY6HrPdRIb9Y3fjhMFJV9a pVwT4XkUKrhnK9OD+lxv35bXc3XJwzVV5px5XeyFAIjXLGsrNT/OB4I/m7TfL6yAWI0J zVTg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+7JG85wgiytF9CmkWJloxgKoIfqFQV9F8GWJGbWrboc=; b=Q2OUOreXZdqkifLCchkuNYn94k6XpqdyQIrzDo/c+AYPnRVw5lkEiRXyzJpYwyq6ft poCcAVPHi6LuIO/RuvbmuXEhLO3dBh7JqHu3GTUbPV1VMYse2BySkKjG4+N5TNmEW9Jt cKreISFnd4qR7IG5MxR5nOkPKROcBKsoSyyAaXzhCgwOYQ1VXWY8cbpmP5xSE9HylaPj RhJSAtQCEWMpSDvLXGDhXt4cY7nkN36DzbtIpYjWt/A1L0MU14oNCtsauEgdtsvbFLPv ZlZRxnffM7LDQAVNePM9t++drADo/3bvMD51FQ2KE57Y0YfT8KsZBzub6YwA4eIEvbAV m6rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=UXFlh9jA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a50d692000000b0046096c494dcsi2187375edi.29.2022.10.25.02.08.05; Tue, 25 Oct 2022 02:08:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=UXFlh9jA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231468AbiJYJGZ (ORCPT + 99 others); Tue, 25 Oct 2022 05:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbiJYJFB (ORCPT ); Tue, 25 Oct 2022 05:05:01 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DA4C15A321; Tue, 25 Oct 2022 02:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1666688639; x=1698224639; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oXpZ9eKaq68nqmZW2GmzFIDev696mazQ2FYejaSR4Ss=; b=UXFlh9jAuXSc5K34/Uun4cxOm1CKUOjO/5LJZ77Sao4A3PtRuMgT02C6 iNb3byDq3sxNr3g4YvFSC9oYX1vLglUBmunBpTZf5TNgZrQZeqz8ZtrKE 3JjkPsIvYpufkpDm1l1s9KTZYYOmekiH5rr+7rAxSYMKTPiamesn+iZ7p 73LVff/bsUSoMR08o0zC2gKVU1Vjo2JcOoDt4aJl1d3ZLnC8+7d61IWd2 XVnQJg2BZHkruFQnl4lauB9EfBF/CvjikaEHFWXBW56kQdLcwKqYLipn3 /pIXZTcPfl1xzdkfKLRXuOr3mz9In1kPGigXAafdL0Tavb/RtUCRexaOW g==; X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="186273117" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Oct 2022 02:03:58 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 25 Oct 2022 02:03:58 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 25 Oct 2022 02:03:55 -0700 From: Tudor Ambarus To: , , CC: , , , , , , , "Tudor Ambarus" , Subject: [PATCH v2 15/32] dmaengine: at_hdmac: Check return code of dma_async_device_register Date: Tue, 25 Oct 2022 12:02:49 +0300 Message-ID: <20221025090306.297886-16-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221025090306.297886-1-tudor.ambarus@microchip.com> References: <20221025090306.297886-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747649991659200516?= X-GMAIL-MSGID: =?utf-8?q?1747649991659200516?= dma_async_device_register() can fail, check the return code and display an error. Fixes: dc78baa2b90b ("dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller") Signed-off-by: Tudor Ambarus Cc: stable@vger.kernel.org --- drivers/dma/at_hdmac.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index afcbad3e1718..858bd64f1313 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1928,7 +1928,11 @@ static int __init at_dma_probe(struct platform_device *pdev) dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask) ? "slave " : "", plat_dat->nr_channels); - dma_async_device_register(&atdma->dma_common); + err = dma_async_device_register(&atdma->dma_common); + if (err) { + dev_err(&pdev->dev, "Unable to register: %d.\n", err); + goto err_dma_async_device_register; + } /* * Do not return an error if the dmac node is not present in order to @@ -1948,6 +1952,7 @@ static int __init at_dma_probe(struct platform_device *pdev) err_of_dma_controller_register: dma_async_device_unregister(&atdma->dma_common); +err_dma_async_device_register: dma_pool_destroy(atdma->memset_pool); err_memset_pool_create: dma_pool_destroy(atdma->dma_desc_pool);