Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4196179rwd; Sat, 3 Jun 2023 23:17:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KUAQmtKcBDkKnSJJRudNqhq3K6ZuI+jnjcJ4BzNmEKcsvgDyFQz9A3yinvKfYg9gJ4KO9 X-Received: by 2002:a05:6e02:810:b0:338:c685:83d1 with SMTP id u16-20020a056e02081000b00338c68583d1mr16077648ilm.10.1685859459740; Sat, 03 Jun 2023 23:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685859459; cv=none; d=google.com; s=arc-20160816; b=LmTfEhdd7N/7l6LEB7nKU6BsvmvNwSn3M9LScb0UIX5kX+dzrtQnrGUoID5+oJMKIC 7sg1ajFpU5uFht74C7AYkCWzV7I/DEuUvRjT60aJ+8VCIlghee1Gp2aDiwcpRPKke9A+ GlK0qk9ci0Cogirg/tponSSnMwFCFq/VfDnDmNp8h73N8SBOv74HbOJmTUdXLEbnYVIk IODvZChZ8mfiX7t2iLSF3rIa7Nxkj9jFPyrXPpSwhqbOyA7yEFEJGzJZDSC+nyMearKr p6JLv71kpnyO/vuuqWau14pCslRDpVWVdulO/5tUj+Z7IPK+xMxsW7RiTNK81hKc96l0 /kCQ== 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:to:from:feedback-id :dkim-signature:dkim-signature; bh=yKoKikTVQbdJ/GWKBdSJlh//T8Gm6Qtq4ujUJMHiy0s=; b=gVuPvYIj+iUPzRNcJX1238FK5Amiq/gc5ycJmmUk0Jh27hgb3F28+uJni+sOH4isdu WeMxd45TJOJS5rqyMI8RoX3jp2ajktePOY8kK9YWSBUieAxX6Pp3BeBmxx9eojaUgFik 9Uj3L/dj+IFwwUxxEGGCUbAvBAHMuKP6T4hb/XjuJuctA5OmHp7n+dXNZj6nRZjQa1tq +U/QJuBGpHo0tNszW72FE0Y4nAtZunXYBiY19o13080bfmXVQ3vZE99OjbEy0HAmSgjP P8frky2kbsSh+I2jsvVrPle5Y1RdieHvfmhKvhY5asm5v4eXjTU1IiUUmJkM/SuFCR2D Ukxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm1 header.b=bzUI2T4M; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=KRGhQa+s; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r190-20020a632bc7000000b00524ea62bcbcsi3727751pgr.209.2023.06.03.23.17.25; Sat, 03 Jun 2023 23:17:39 -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=@sakamocchi.jp header.s=fm1 header.b=bzUI2T4M; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=KRGhQa+s; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbjFDFpW (ORCPT + 99 others); Sun, 4 Jun 2023 01:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjFDFpF (ORCPT ); Sun, 4 Jun 2023 01:45:05 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0312BDD for ; Sat, 3 Jun 2023 22:45:05 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 71AF85C0107; Sun, 4 Jun 2023 01:45:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 04 Jun 2023 01:45:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1685857504; x= 1685943904; bh=yKoKikTVQbdJ/GWKBdSJlh//T8Gm6Qtq4ujUJMHiy0s=; b=b zUI2T4MtRqQFE0xkxyHAewvPaapTG9qww6k+9Ol6Sn+o/uxlk/w6ulvDqKRg5uBm B3otPR2jHuc8bomo6SReGWTP6WFHcSdMDI5E8QlT1QotoHuudMhGTcy3vICmsBwf v3Ymx9SGeFaOlwLQYCRoC+JE/12t6AP5VG5DIo9Zf5p/zGvEcRKSHfL7que0ejVu XG+xVM1ddS/pfMi8wOvIPfDYrpp3NFBWKG+F2jGEuFh4Y0FYIdVWBYrgUf7FwbSG kuUG4UXbClC9shjfq12S5JXUJK+dIw1+oAh7unif7+/nbtA4qOS81Ub/bNQQZNV7 N48iqILJEYkyYgGzY6BdQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1685857504; x=1685943904; bh=y KoKikTVQbdJ/GWKBdSJlh//T8Gm6Qtq4ujUJMHiy0s=; b=KRGhQa+sc+UZutBiz ZqDiBiY0L9tMY+geOqh6qC2uvtTAON/b7rIKWWhbuhAFH7bbRVSGZUsQurhXpvC1 7gFqu2VUH+0DgmFK5YZvEpZ5IfJomr/ewolgJ+wdHXDXuRBvbgqtvkxO28TapksD 3rf9+5ca5ucHWJwLN5SUfoZfLHI4vzaS14FOuU6jowkTe7ty6pQIFFEF5BE+UcFE 80qQ1WMm3213THgxP6jwgngFqP1O4a5VDEwi+yL5er29/xWj3BbdbrlRpkzS5C/F NsvWukJ3d0ZuWIQ1XhBpAmIOQ13kyzojp98wSswm9Kj55ic1s4ceQ1Ku80Ppfi0N FAJwA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeliedguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 4 Jun 2023 01:45:03 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 6/9] firewire: ohci: use devres for list of isochronous contexts Date: Sun, 4 Jun 2023 14:44:48 +0900 Message-Id: <20230604054451.161076-7-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230604054451.161076-1-o-takashi@sakamocchi.jp> References: <20230604054451.161076-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 The 1394 OHCI driver allocates the list of isochronous contexts as much as the hardware supports. This commit utilizes managed device resource to maintain the lifetime of list. Signed-off-by: Takashi Sakamoto --- drivers/firewire/ohci.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index cb6b43e3f67e..086505bd1729 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -3666,7 +3666,11 @@ static int pci_probe(struct pci_dev *dev, ohci->ir_context_mask = ohci->ir_context_support; ohci->n_ir = hweight32(ohci->ir_context_mask); size = sizeof(struct iso_context) * ohci->n_ir; - ohci->ir_context_list = kzalloc(size, GFP_KERNEL); + ohci->ir_context_list = devm_kzalloc(&dev->dev, size, GFP_KERNEL); + if (!ohci->ir_context_list) { + err = -ENOMEM; + goto fail_atresp_ctx; + } reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, ~0); ohci->it_context_support = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet); @@ -3679,11 +3683,10 @@ static int pci_probe(struct pci_dev *dev, ohci->it_context_mask = ohci->it_context_support; ohci->n_it = hweight32(ohci->it_context_mask); size = sizeof(struct iso_context) * ohci->n_it; - ohci->it_context_list = kzalloc(size, GFP_KERNEL); - - if (ohci->it_context_list == NULL || ohci->ir_context_list == NULL) { + ohci->it_context_list = devm_kzalloc(&dev->dev, size, GFP_KERNEL); + if (!ohci->it_context_list) { err = -ENOMEM; - goto fail_contexts; + goto fail_atresp_ctx; } ohci->self_id = ohci->misc_buffer + PAGE_SIZE/2; @@ -3721,9 +3724,7 @@ static int pci_probe(struct pci_dev *dev, fail_msi: pci_disable_msi(dev); - fail_contexts: - kfree(ohci->ir_context_list); - kfree(ohci->it_context_list); + fail_atresp_ctx: context_release(&ohci->at_response_ctx); fail_atreq_ctx: context_release(&ohci->at_request_ctx); @@ -3767,8 +3768,6 @@ static void pci_remove(struct pci_dev *dev) ar_context_release(&ohci->ar_response_ctx); context_release(&ohci->at_request_ctx); context_release(&ohci->at_response_ctx); - kfree(ohci->it_context_list); - kfree(ohci->ir_context_list); pci_disable_msi(dev); dev_notice(&dev->dev, "removing fw-ohci device\n"); -- 2.39.2