From patchwork Thu Apr 11 21:17:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13626558 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 10EB4C4345F for ; Thu, 11 Apr 2024 21:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LKayrDQ+zv0Xbkqx4MySRHbPflAlM9Rz21UAiAyJ6lY=; b=l87Tg2vUxQ3zIq /HbdOyfojEbqZovKUvCMqYnGTKyrGb16ZfJStYnUsyQco8wddrPkY8A2xALb4fNaPdTNytkRRg9re ceBcFL7U19+iI1ZLJJEAIZwEH0aRlpCA6/o46MNYvAlvqEekTbKNbNfh6QtRebal4u4N4pjkwmC0i FuwE2UI/8PHIg1dMgS4SpAtEq/WKK8Ums6FNFJKP4/9Mt7lcupS8kzPgHfM6PPXvU9gMo0dOhctMH BqKm+hGOKFDZ3XCJKJd8We3SXE8Ug/n1q3JTFAMPD5Zb7ACFqiBL2/JwxbmHPou/0xhR1SevQR8ye GRFtIrLKGGiPJHQz1+xw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1o0-0000000E9i2-3EhR; Thu, 11 Apr 2024 21:18:00 +0000 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1nv-0000000E9fF-0Zob for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 21:17:59 +0000 Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-434a6024d0aso542381cf.0 for ; Thu, 11 Apr 2024 14:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712870274; x=1713475074; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KJkkcaX8CIYhd9XR8ScMRJRxMuN5zFK8kc96J/lpLIM=; b=KMkSkbbBxnTld7qeXBnuCaQfUPWz4IfJZBFOy0ztvKs1mCewel6ZpmgKU3BEPhArJX xU0ZvgP/P/u9tRRSQn6yf8x1VMwnU8zL97eSG7frndBTdKJX7lwWfoQP7TGwSEHIJFu5 hsBH2ulpM//Xaje+e/2NTup/hSZ+LMHD/wpL4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712870274; x=1713475074; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KJkkcaX8CIYhd9XR8ScMRJRxMuN5zFK8kc96J/lpLIM=; b=Kj+S2v07OK7YBas31K0FHplr06fbv19WX4K8e6eNCmF05Hlu2VR6hNDQ0Zxp0hYrzc FLB1YDGbcDXG+lTRPPC8pGzEoHQEbufmuKLIkP0puxkBtCdRTzUjFma73Qa4XNHvHMzt uBcmQIaMoqE4R3uF0rx5UF0o8jezrzXFIJlpaVMTXEdgGH2wjZ1qqolM1c6SB9goN4ss BMbY2jwOqbrDVintE4F1XH8Aw6yvDm8XrC1ms+97hlrz13O6EgBXMqBIB1VDMn76a9X2 0bD7OZG14sH+OeeoqS9F6787Bk4TI21DNBx99GkeDiUHrbE5/O90VC8GDbnimTw2T+/J o2dg== X-Forwarded-Encrypted: i=1; AJvYcCWFXqV2eNVhKNZmdSG+VD32GeyOSqD+w4fgxIN5ILgwJteAohDcth7A3erOxvhY2QuinXNKTsqdUg5EefHhfQohqB3eEE5Bo40/Ps0F88XMUL1C0g0= X-Gm-Message-State: AOJu0YziXf/TGWGtILyRTDpDAVaZ9w9nYmyESJXmrGsgtPFCQtzb63gg zhnV1++VdhblIc+Ycg69xzFlrBjPsPXIade4d6iiOZdMg6xz/+1lcKvnjZdiRA== X-Google-Smtp-Source: AGHT+IFTnqRZcteRINuntinTUGBmdgsxI+3hZuPuD7cseAqS47blu7YOY7bCkvUON9r8YSt9U/Nl/Q== X-Received: by 2002:a05:622a:107:b0:434:68f6:ae2a with SMTP id u7-20020a05622a010700b0043468f6ae2amr1066381qtw.16.1712870273700; Thu, 11 Apr 2024 14:17:53 -0700 (PDT) Received: from denia.c.googlers.com (200.234.86.34.bc.googleusercontent.com. [34.86.234.200]) by smtp.gmail.com with ESMTPSA id k20-20020ac84794000000b00434d7c4f9fasm1373362qtq.8.2024.04.11.14.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:17:52 -0700 (PDT) From: Ricardo Ribalda Date: Thu, 11 Apr 2024 21:17:50 +0000 Subject: [PATCH 1/7] media: solo6x10: Use pcim functions MIME-Version: 1.0 Message-Id: <20240411-fix-smatch-v1-1-045f92467937@chromium.org> References: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> In-Reply-To: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> To: Bluecherry Maintainers , Anton Sviridenko , Andrey Utkin , Ismael Luceno , Mauro Carvalho Chehab , Patrice Chotard Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_141755_269336_1CD0DFDE X-CRM114-Status: GOOD ( 11.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Instead of handling manually the release of the memory regions let devm do that for us. Makes smatch happy: drivers/media/pci/solo6x10/solo6x10-core.c:631 solo_pci_probe() warn: 'pdev' from pci_request_regions() not released on lines: 631. Signed-off-by: Ricardo Ribalda --- drivers/media/pci/solo6x10/solo6x10-core.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/media/pci/solo6x10/solo6x10-core.c b/drivers/media/pci/solo6x10/solo6x10-core.c index 6d87fbb0ee04a..abf30b7609e17 100644 --- a/drivers/media/pci/solo6x10/solo6x10-core.c +++ b/drivers/media/pci/solo6x10/solo6x10-core.c @@ -145,10 +145,8 @@ static void free_solo_dev(struct solo_dev *solo_dev) /* Now cleanup the PCI device */ solo_irq_off(solo_dev, ~0); free_irq(pdev->irq, solo_dev); - pci_iounmap(pdev, solo_dev->reg_base); } - pci_release_regions(pdev); pci_disable_device(pdev); v4l2_device_unregister(&solo_dev->v4l2_dev); pci_set_drvdata(pdev, NULL); @@ -480,15 +478,10 @@ static int solo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) pci_write_config_byte(pdev, 0x40, 0x00); pci_write_config_byte(pdev, 0x41, 0x00); - ret = pci_request_regions(pdev, SOLO6X10_NAME); + ret = pcim_iomap_regions(pdev, BIT(0), SOLO6X10_NAME); if (ret) goto fail_probe; - - solo_dev->reg_base = pci_ioremap_bar(pdev, 0); - if (solo_dev->reg_base == NULL) { - ret = -ENOMEM; - goto fail_probe; - } + solo_dev->reg_base = pcim_iomap_table(pdev)[0]; chip_id = solo_reg_read(solo_dev, SOLO_CHIP_OPTION) & SOLO_CHIP_ID_MASK; From patchwork Thu Apr 11 21:17:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13626561 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D7D4C4345F for ; Thu, 11 Apr 2024 21:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0EayIsmAV41Wt5kEdOEFVW3EooZ7UyqHxy6/v7CrqaU=; b=JYxqCi+1dpUwJu 3hAhzpKCwCDiMFnJuOzR39u00A5vW81zvgjWW8ERXC9BVzdei6VO8NYphY8qIA4WUE/qfQigg3TQX Lz+ugx4zrHySXefH/c/2QnaxyVNa0yCyM8oVOv5be/E0+fKrE7C0yqeoOpJhRA+n4gwmUoln+cCjN 2uGQP1v2/zL546Q8zwBxuSBLxB3c7ZDpTcUhOoiBcHabialDcUEYuvs/3zoE121kvoMZK1NPGTbEg qAvZEKC+mm+xlPbfNLVBmlN2N9Aq2DAHDRkgbbBu9YEe9v1p0slMOvJDDSKHlER5AvIEP9+rggIOu INd3v/ucH41yN8suxxsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1oN-0000000E9vU-1vjp; Thu, 11 Apr 2024 21:18:23 +0000 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1nz-0000000E9fI-3azx for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 21:18:02 +0000 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3c5d5de746cso75908b6e.0 for ; Thu, 11 Apr 2024 14:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712870274; x=1713475074; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=A4R8SNBXJ275CXC4IwKn1Nf9LGrTrEst208ivldsCOI=; b=fGOt2J+SLTaxtPdOHN6S9RFTnQadFu3hQvhsmdHVEi9xMKPaEzMXZLqX28q1epG3MP r8OWVw9f7aA1EsUKOmVBlnGy0tGzDhcz/5ewkwxTC+7lb9arM+rL8idjP7KGFYVcf6OD Ah3bqg/2f3BSEOrwlBaTPDfVI0Kc1qsJpbflw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712870274; x=1713475074; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A4R8SNBXJ275CXC4IwKn1Nf9LGrTrEst208ivldsCOI=; b=HNq9XaH0rO2eNHRIowW/6OksSYYKYQnjgtC4xIVPVG6Sop5UzLvKLMcYnFyjw1RbO3 PdswBiC7xWNHj4wduhiU4Ig6MBRvWU/FFCEb6x2f0ABCDjP955SrI5sl04NPbVZF6K07 C8Mipyiai619s8uTvIhpbVMC1bsIu+ldnABxitjcrBwiRrQ+TPWQXB1jtA8thJ8Mc/Tg ivKm3/G4ZqI2MPuz71d7OTSuUIlM+BaR9mZp70uOZ+bkVzCFjeC4X+UzAjmp5NmZcERt Yg/UP9T2F9/3RewDU+EvkYWaHPv/rGdEvewCaygxUBs0+sXBJflw1Cyj3lWt+f5SufpY syAA== X-Forwarded-Encrypted: i=1; AJvYcCVucBIy146hucUO8t5G8M43BYvEHv5ySc4M5t6p5G49ZsuBoO9hMIDlJiFObcPUKAl+3Zu++bIRDZe2Fbg6oZgl0dlGKyuFIQK/U8x9oHzcYlzjMYU= X-Gm-Message-State: AOJu0Yy1rQy4BuGrB9w+pn4jR7GCS0hUyREM4MyGx5q9wLnnmCF2kKT5 HQsK0xYidMN/ngB5aQWNulh0vy3Ux88D+l/b3dSqa8xnCjIw6G8JRvgSeFrbAw== X-Google-Smtp-Source: AGHT+IEC1vdgwkjJJheMAKozxbMmu/L/tTm4eEGL7yncy97G5OW/5qnYsDss86EcRfqPSpyjplNl8g== X-Received: by 2002:a05:6808:1cf:b0:3c4:f70b:7755 with SMTP id x15-20020a05680801cf00b003c4f70b7755mr793202oic.20.1712870274492; Thu, 11 Apr 2024 14:17:54 -0700 (PDT) Received: from denia.c.googlers.com (200.234.86.34.bc.googleusercontent.com. [34.86.234.200]) by smtp.gmail.com with ESMTPSA id k20-20020ac84794000000b00434d7c4f9fasm1373362qtq.8.2024.04.11.14.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:17:54 -0700 (PDT) From: Ricardo Ribalda Date: Thu, 11 Apr 2024 21:17:51 +0000 Subject: [PATCH 2/7] media: solo6x10: Use devm functions MIME-Version: 1.0 Message-Id: <20240411-fix-smatch-v1-2-045f92467937@chromium.org> References: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> In-Reply-To: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> To: Bluecherry Maintainers , Anton Sviridenko , Andrey Utkin , Ismael Luceno , Mauro Carvalho Chehab , Patrice Chotard Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_141800_050593_BD5DD466 X-CRM114-Status: GOOD ( 10.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Let devm handle the life cycle of the irq request. Makes smatch happier: drivers/media/pci/solo6x10/solo6x10-core.c:631 solo_pci_probe() warn: 'pdev' from pci_request_regions() not released on lines: 631. Signed-off-by: Ricardo Ribalda --- drivers/media/pci/solo6x10/solo6x10-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/solo6x10/solo6x10-core.c b/drivers/media/pci/solo6x10/solo6x10-core.c index abf30b7609e17..1a9e2bccc4136 100644 --- a/drivers/media/pci/solo6x10/solo6x10-core.c +++ b/drivers/media/pci/solo6x10/solo6x10-core.c @@ -144,7 +144,6 @@ static void free_solo_dev(struct solo_dev *solo_dev) /* Now cleanup the PCI device */ solo_irq_off(solo_dev, ~0); - free_irq(pdev->irq, solo_dev); } pci_disable_device(pdev); @@ -544,8 +543,8 @@ static int solo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* PLL locking time of 1ms */ mdelay(1); - ret = request_irq(pdev->irq, solo_isr, IRQF_SHARED, SOLO6X10_NAME, - solo_dev); + ret = devm_request_irq(&pdev->dev, pdev->irq, solo_isr, IRQF_SHARED, + SOLO6X10_NAME, solo_dev); if (ret) goto fail_probe; From patchwork Thu Apr 11 21:17:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13626560 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A659C4345F for ; Thu, 11 Apr 2024 21:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=i/F2vCm+Kim+Lwx3arpnapqwVKQLDJS0thymJw2uUDA=; b=qJ6pfukgoTqh5k 3WbtcBR/G5Y0UWaw0QCLes4QbaG0qBZ3M/CikkLyI82zt7o4WYH+a0WyrVXIp/fANoZsg3Nxl672b fbr0lzaXTiNbeMhIY1t6zXPzkCYtBJgF4C9fZOuHRc2V6UbED6fhIyGtOWFTEaI+W9891luQPM9tH n4R3wGZGQxL9ctz6FyFq2ehRrWpZDkjGYKe4b3qjJCLP0iQ4p9g1bCezQfdmCx0daeon0y9nJE0qQ 0vjWkLv1O38B33cOIYHHS5votw69P/uRfIcaq0wxzDvU+dLuARNhYgtNmBuIaIGfuL8h7T2pOIewi zO3oZ/I7d5puTkAO4lkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1oB-0000000E9pQ-1wnO; Thu, 11 Apr 2024 21:18:11 +0000 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1nz-0000000E9fx-3bIT for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 21:18:01 +0000 Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-5aa2551d33dso188704eaf.0 for ; Thu, 11 Apr 2024 14:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712870276; x=1713475076; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Lp9xnoohaSw2cIC3dXNX7smv9LqAayoL7R0pHvEFgA4=; b=XgB8EcUNZ8JiRqI1CIabWYmOHsayCr/QDs0yIqGRI3Bdk+isIjoE+JlVcoNhX20R6J SHhUFC0rm/Dtb8RufCmvedKUeJcH9+rs0NSEgFwHgyUq9wQE0ZYvZjSFVLjwVObhPAVI PNFWjB0NRbclK/9uthZsKm0g8aefGGo+xzTL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712870276; x=1713475076; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lp9xnoohaSw2cIC3dXNX7smv9LqAayoL7R0pHvEFgA4=; b=jsEvMIR31HL3MgSj0tJgCd2ms9y89vs34oXpCwsfP3Pi3CoXGnjDiVv4Kt9ytRSXO3 LvpvjBe3c55sIQQpEWiaFvSgRYGx7fMLwnzMYo8/xMUwriuJygA561+u2CKiyl2dMJUK ASJ/V0WJsY913pPC2rpf36gMfGeeS0+F27USHf8kCF/iWe8CybJd/dN5RC2vLca7Cx86 gl3UgdxG/3ouMAvxxndIyxdJyvam6fS0qqa+VBbWm0K9CO0QB3ITIa46tUa8vtmM+Esb /c1E956aKyl8Qoae85e6Cj0VEOolHa8pzPccTtCKeBGJuxy0dZ6PNJFF68Pd0i6U8Mnx jpvQ== X-Forwarded-Encrypted: i=1; AJvYcCW9HizWQCpuVBlt7TGyGxS+RtJ0m6XkrUN/9dR5r8PNxV8LOREKvGzVSSX1QgGGQ/Mzms/YZGXwQSf9SQ6jCoocoet1FIf1ZuWF2rpQ+fjTlidhpjM= X-Gm-Message-State: AOJu0YxR2eqzATpyobaLjFKEwzSK5zggc8CJUyBaeVuSUzg3ZyOcwd59 DDd1VwuZvHtg0/wB5aKWLqL90XZG3GACta2xTAbxHnlBJh1Hzfmx0r1hB5y8iQ== X-Google-Smtp-Source: AGHT+IH3PJPjNl18QWxefWFNkOVbJgNcIMMPhh3UNIigB6AYGmwgvHF3AHr6NydkhiUfqoz4uLkfNA== X-Received: by 2002:a05:6358:838c:b0:183:7f41:8c10 with SMTP id c12-20020a056358838c00b001837f418c10mr339839rwk.31.1712870275864; Thu, 11 Apr 2024 14:17:55 -0700 (PDT) Received: from denia.c.googlers.com (200.234.86.34.bc.googleusercontent.com. [34.86.234.200]) by smtp.gmail.com with ESMTPSA id k20-20020ac84794000000b00434d7c4f9fasm1373362qtq.8.2024.04.11.14.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:17:55 -0700 (PDT) From: Ricardo Ribalda Date: Thu, 11 Apr 2024 21:17:52 +0000 Subject: [PATCH 3/7] media: saa7134: Use devm_request_irq MIME-Version: 1.0 Message-Id: <20240411-fix-smatch-v1-3-045f92467937@chromium.org> References: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> In-Reply-To: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> To: Bluecherry Maintainers , Anton Sviridenko , Andrey Utkin , Ismael Luceno , Mauro Carvalho Chehab , Patrice Chotard Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_141800_009318_E929584F X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The handled version of request_irq let us remove the free_irq and makes smatch happier: drivers/media/pci/saa7134/saa7134-alsa.c:1186 alsa_card_saa7134_create() warn: 'dev->pci->irq' from request_irq() not released on lines: 1186 Signed-off-by: Ricardo Ribalda --- drivers/media/pci/saa7134/saa7134-alsa.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c index d3cde05a6ebab..dd2236c5c4a17 100644 --- a/drivers/media/pci/saa7134/saa7134-alsa.c +++ b/drivers/media/pci/saa7134/saa7134-alsa.c @@ -1096,9 +1096,6 @@ static void snd_saa7134_free(struct snd_card * card) if (chip->dev->dmasound.priv_data == NULL) return; - if (chip->irq >= 0) - free_irq(chip->irq, &chip->dev->dmasound); - chip->dev->dmasound.priv_data = NULL; } @@ -1147,10 +1144,8 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) chip->iobase = pci_resource_start(dev->pci, 0); - err = request_irq(dev->pci->irq, saa7134_alsa_irq, - IRQF_SHARED, dev->name, - (void*) &dev->dmasound); - + err = devm_request_irq(&dev->pci->dev, dev->pci->irq, saa7134_alsa_irq, + IRQF_SHARED, dev->name, &dev->dmasound); if (err < 0) { pr_err("%s: can't get IRQ %d for ALSA\n", dev->name, dev->pci->irq); From patchwork Thu Apr 11 21:17:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13626562 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01D15C001CC for ; Thu, 11 Apr 2024 21:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FPenCDvWTyprs3ZNiz8As1nzyN4oImyhmTO58IYMq3E=; b=G+jFusx8mDY2Db 9SLv0QqgQawpC7TlldCgfhMcw6gIarGQU9BpYab7f03pOgCX7opKLO7TXC4VhdEPe6eLI5sKnT6+H 73bjLn5TTFlgSimEsuFNAe/L9RMUIPq771jvZlMtn96jYSi7szOUj2V99fW61KsqXWsN9MN9RtupK 25ave79ak6RvBY9h/fpSMTMMyQE631Bf+61rY+YR9wLZL13ycgzrk+vmmGS7uZBhei+MEigU0IcbN nOhGoiSvG+YKUV7wpZTpqm+SYxpzYtY3UAmzzmlTfU+a6l+nmjtIp4aiIF8WZVTcl+7lr+kYERktl DyqTQOnpybzT804tk45A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1oO-0000000E9w4-18ne; Thu, 11 Apr 2024 21:18:24 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1nz-0000000E9gL-3aTT for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 21:18:03 +0000 Received: by mail-qt1-x830.google.com with SMTP id d75a77b69052e-4347bcc2b47so914041cf.3 for ; Thu, 11 Apr 2024 14:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712870277; x=1713475077; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=TL6JnALE0FuyaUB3vxEn5mmMwRa1J5olT0hONBuxBN8=; b=Y4mYMFD5s/mlwl9CuW4ei0gide/+oMJyBh6s1zfymhwH0IQTsC6EsEN5rs6sTOlmBH XHcEdihK7DJ7rtlQCOaA6i4mAR/e34DRxPvIfo+kM4Zn8H3WHqTAqCiu9Cgtj5L0exyI KtFn8PkWknc8zmeL1Ak0Vpr9KJLSylWdNM/pg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712870277; x=1713475077; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TL6JnALE0FuyaUB3vxEn5mmMwRa1J5olT0hONBuxBN8=; b=YHXwGrIitiMrfYG0Ti7Y65jEYeYzFbQlwTl/Z23gvNg1TudWZM08Of1/LIDmxI4XxG mw8JPd3dzJfemk8RdjOybbgttwZGnaJmbAa7q6mREg7myQOS0dqu/RXRfZue9A/LgCoI 8kPQ3Vgbn7Tj4XyVX/kTqV3yAxdhpBAuLOJcT40HA4OIMXx3Sb0FuBHKp8GyXuqNWKr3 izLlD40ytSLo2h4M2IDdcEObsV9WqXApQWBn2DtcSCeaSQCxqovJgxMst2Yjs7muJmDp NgcjZBvq8SvL3/4V2X08nShdq8mpysfyTImXawOq4RyGUQ0EuOY/AnRsK56ZWhtbNqz8 vpAQ== X-Forwarded-Encrypted: i=1; AJvYcCUwTdy6BH3iUvfl4a2XcuaMy80fUVErCInBpYixR2F6B7/QAGlgU6ZuvMOq/vlNpbf4eV8xZNbLaFXG4gbZXkZWSA2NNE4IOoqJbu6tuRbz8NEksUw= X-Gm-Message-State: AOJu0YwHRJ94dJASwF9UoZ0VP2JQvOi/nN5LLHJSbDfbmZH1pvKVIcNE y+R+DE3TuPUKoJ23EMgMHQjyKmnzcUpGoy8z5L32r4ZfEaKY5yOL24xpc10CuA== X-Google-Smtp-Source: AGHT+IE1U/PUZQGaG+rxwc5mHpekiX8Y0J1WJQ10omBwhTFJ78n8RVlNr6NTsPRSnF/PRA/dbuDuOg== X-Received: by 2002:a05:622a:1897:b0:436:89bf:5706 with SMTP id v23-20020a05622a189700b0043689bf5706mr270247qtc.17.1712870277703; Thu, 11 Apr 2024 14:17:57 -0700 (PDT) Received: from denia.c.googlers.com (200.234.86.34.bc.googleusercontent.com. [34.86.234.200]) by smtp.gmail.com with ESMTPSA id k20-20020ac84794000000b00434d7c4f9fasm1373362qtq.8.2024.04.11.14.17.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:17:56 -0700 (PDT) From: Ricardo Ribalda Date: Thu, 11 Apr 2024 21:17:53 +0000 Subject: [PATCH 4/7] media: c8sectpfe: Refactor load_c8sectpfe_fw MIME-Version: 1.0 Message-Id: <20240411-fix-smatch-v1-4-045f92467937@chromium.org> References: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> In-Reply-To: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> To: Bluecherry Maintainers , Anton Sviridenko , Andrey Utkin , Ismael Luceno , Mauro Carvalho Chehab , Patrice Chotard Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_141800_093616_6817D89A X-CRM114-Status: GOOD ( 12.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org release_firmware() in the same function that it was requested. It is more clear and makes smatch happy. drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c:1146 load_c8sectpfe_fw() warn: 'fw' from request_firmware() not released on lines: 1125,1132. Signed-off-by: Ricardo Ribalda --- drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c index e4cf27b5a0727..ce0fd6ace8032 100644 --- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c +++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c @@ -1097,7 +1097,6 @@ static int load_slim_core_fw(const struct firmware *fw, struct c8sectpfei *fei) } } - release_firmware(fw); return err; } @@ -1121,6 +1120,7 @@ static int load_c8sectpfe_fw(struct c8sectpfei *fei) } err = load_slim_core_fw(fw, fei); + release_firmware(fw); if (err) { dev_err(fei->dev, "load_slim_core_fw failed err=(%d)\n", err); return err; From patchwork Thu Apr 11 21:17:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13626564 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9F03C00A94 for ; Thu, 11 Apr 2024 21:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MulleSb3pYUvUT4fqK4fl8sh3rqfyYpn+53DRy2Uq50=; b=ECoGDEpRcIiZcq PL1YvM7N0dyJLA0DZynmM+7veh0BeIahBE2zMqNp5t0tdmxQFe6hvRNA0zaOh/YstzpcMPzLWsyJx PhlsCE+W0hleikPFi768wyCnWosPLXNb1RPCEkn2yxbyCxQegVd/MpzFS0hYsvDFMVR64MfK35lrc 5ChLDyKuaKl7M1SrYP4YsuHIOSvn8L+7fe9hn+ws7WK7g1OKJv28iMVtmG0RNkwzG5rsezlWiHIf7 benySLgxTH/2dX6snmziMFzZBIu6LMs2ZObYxKUunNtWszxLaExdHTvX7LVomD7te7kYGhIg/iptk Rgh83QPMw0qb+sBwOtsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1oP-0000000E9wf-35B2; Thu, 11 Apr 2024 21:18:25 +0000 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1nz-0000000E9gd-3aFn for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 21:18:03 +0000 Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-5aa12c21ff4so183008eaf.3 for ; Thu, 11 Apr 2024 14:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712870278; x=1713475078; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7uKL1mHSZL4YF4kY3BJqD6MsU90syv43Ru49OzukfDM=; b=ce9Dl1UD81Z0SozWCP/fuEs/D+57GcwJRyXiNbSbLLRzAnYq0MF97hu4ZBJ/FdKFoo Mma0ZwGfQ7mWW6aVdFZJbSAj9gm+/SH6LRCZGT2w8Mx4iQ6uyB2w4pCg9emLZgysNtvm CDlvPyXF+Lu2k6wni+KF7dB/K/QeVy5GKGMTo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712870278; x=1713475078; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7uKL1mHSZL4YF4kY3BJqD6MsU90syv43Ru49OzukfDM=; b=OjGsehCGosQto9vs2Vl2nVcnQH+kFaB1FGSJUx1HpI1F2vI7Hs6qiwhtZmCvG5Df2i iigNStSyert4EwCQC+CapBTK4GWPjrGDP3MK4Wefb/OSZzALbZ/6xjIUGoKImmoSQX5E 99NLnuhURB/7Kn9Z9Yl//OmaaGjUVuVgyLWTtwhsqpFJGvaEeB6GxTAnipy8WjdsPbDj zihJav6Ts8OSP8fMJH8EkYHxQyQUxuME1+Y5OnlN3JJR0AF0lP9LW3KEkNoHwwiEMtif 4/IQ5o2jifcCyax3Xar8z/1dVHvqPT/FwhoRBSz8rIzRAD+lZwHws0DvFmkLmWPIPhVp n0Vg== X-Forwarded-Encrypted: i=1; AJvYcCWbgb+po4zR0suEGdFcrp0KdrZzHo2drMiqZVnKKU1xzVuX3gPJvPnDV5fvmu//0b5rEfRxM9YnulzNpX7hA29DuvqsgzYbutbmsTrb7Uy0NA1N4DU= X-Gm-Message-State: AOJu0Yyy8WweYMwMJ2poUWYWIRrC+DrtO2EihHNCdwDkGNBWVKLJyhE3 nbpyHS/t62z1JqpdjX5dWH7jBz+3KOE3VRy12fqKAilKp1oOhoCCp4YWLak2mQ== X-Google-Smtp-Source: AGHT+IGhlN9obDs811TzuFeTw+yQpMZFy0dDvN3jgb99c2lssw4pJXubU4SOxjWfkOF/RoOypkxSZg== X-Received: by 2002:a05:6358:9807:b0:186:12cb:d1a8 with SMTP id y7-20020a056358980700b0018612cbd1a8mr629894rwa.25.1712870278344; Thu, 11 Apr 2024 14:17:58 -0700 (PDT) Received: from denia.c.googlers.com (200.234.86.34.bc.googleusercontent.com. [34.86.234.200]) by smtp.gmail.com with ESMTPSA id k20-20020ac84794000000b00434d7c4f9fasm1373362qtq.8.2024.04.11.14.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:17:58 -0700 (PDT) From: Ricardo Ribalda Date: Thu, 11 Apr 2024 21:17:54 +0000 Subject: [PATCH 5/7] media: tunner: xc5000: Refactor firmware load MIME-Version: 1.0 Message-Id: <20240411-fix-smatch-v1-5-045f92467937@chromium.org> References: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> In-Reply-To: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> To: Bluecherry Maintainers , Anton Sviridenko , Andrey Utkin , Ismael Luceno , Mauro Carvalho Chehab , Patrice Chotard Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ricardo Ribalda , Shuah Khan X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_141800_042340_B99C1CEE X-CRM114-Status: GOOD ( 16.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make sure the firmware is released when we leave xc_load_fw_and_init_tuner() This change makes smatch happy: drivers/media/tuners/xc5000.c:1213 xc_load_fw_and_init_tuner() warn: 'fw' from request_firmware() not released on lines: 1213. Cc: Shuah Khan Signed-off-by: Ricardo Ribalda --- drivers/media/tuners/xc5000.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c index 2182e5b7b6064..30aa4ee958bde 100644 --- a/drivers/media/tuners/xc5000.c +++ b/drivers/media/tuners/xc5000.c @@ -58,7 +58,7 @@ struct xc5000_priv { struct dvb_frontend *fe; struct delayed_work timer_sleep; - const struct firmware *firmware; + bool inited; }; /* Misc Defines */ @@ -1110,23 +1110,19 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force) if (!force && xc5000_is_firmware_loaded(fe) == 0) return 0; - if (!priv->firmware) { - ret = request_firmware(&fw, desired_fw->name, - priv->i2c_props.adap->dev.parent); - if (ret) { - pr_err("xc5000: Upload failed. rc %d\n", ret); - return ret; - } - dprintk(1, "firmware read %zu bytes.\n", fw->size); + ret = request_firmware(&fw, desired_fw->name, + priv->i2c_props.adap->dev.parent); + if (ret) { + pr_err("xc5000: Upload failed. rc %d\n", ret); + return ret; + } + dprintk(1, "firmware read %zu bytes.\n", fw->size); - if (fw->size != desired_fw->size) { - pr_err("xc5000: Firmware file with incorrect size\n"); - release_firmware(fw); - return -EINVAL; - } - priv->firmware = fw; - } else - fw = priv->firmware; + if (fw->size != desired_fw->size) { + pr_err("xc5000: Firmware file with incorrect size\n"); + release_firmware(fw); + return -EINVAL; + } /* Try up to 5 times to load firmware */ for (i = 0; i < 5; i++) { @@ -1204,6 +1200,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force) } err: + release_firmware(fw); if (!ret) printk(KERN_INFO "xc5000: Firmware %s loaded and running.\n", desired_fw->name); @@ -1274,7 +1271,7 @@ static int xc5000_resume(struct dvb_frontend *fe) /* suspended before firmware is loaded. Avoid firmware load in resume path. */ - if (!priv->firmware) + if (!priv->inited) return 0; return xc5000_set_params(fe); @@ -1293,6 +1290,8 @@ static int xc5000_init(struct dvb_frontend *fe) if (debug) xc_debug_dump(priv); + priv->inited = true; + return 0; } @@ -1306,10 +1305,6 @@ static void xc5000_release(struct dvb_frontend *fe) if (priv) { cancel_delayed_work(&priv->timer_sleep); - if (priv->firmware) { - release_firmware(priv->firmware); - priv->firmware = NULL; - } hybrid_tuner_release_state(priv); } From patchwork Thu Apr 11 21:17:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13626563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C852C4345F for ; Thu, 11 Apr 2024 21:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DJYhg9Axkf1msZ+5NYEDR2yp8HNezfABzOIcl1iOnLw=; b=eXRx42dib/tejJ 1FVUMs+L8pAmxk6eDiqY4VKdG8oWYNhUOK310rYaf+Vg3T/imm3kaKiz5kWHDBK2Je9wOv9DKWXn6 hPnYwK7jy+vu8VTHbWTg4TiqpaCD5LeoYafW5h5TGVwN1LzCOMTyJPFqhOt77YsBaxLDjcwREBIRU vGnNS7/ntrDNfXayFsgYYDAGlpC2JMbxxZZfUweVyHaTFbaLCm0Rcx1w5x33FfSK6LuNo9XGXKEoc oVnrXDgmk60OwQxO15Xs0vEYGbkEG2PwgII5vqrLVO8Bfgyi1nExmaGIjHQ8Ur/tkGkoSX95Bwlee TlOFuuIDiP2NvEzeZKYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1oT-0000000EA0L-26Hn; Thu, 11 Apr 2024 21:18:29 +0000 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1o1-0000000E9iY-09hT for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 21:18:04 +0000 Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-5aa1b7a37b5so178516eaf.2 for ; Thu, 11 Apr 2024 14:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712870280; x=1713475080; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=e5nSR1yFGYwMcL96r69NW1l3sh3LFO29KJ2x2ErdnHk=; b=OYJDKvVEelSBCElThvkou6ydXJKp/ha+1YhxsuJfDIWTELt0QW0Fw5a8XBQyCaovGj 7Gb8j4ux+GheIDa6eyRXnKceQc8v/FSqUToVtrTbo/LjkBnY6MZhkBQDUaGwBA1kxSdm 86OMvYKCx/m7U6Dobl24MzxAAm1AqQes+DiMw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712870280; x=1713475080; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e5nSR1yFGYwMcL96r69NW1l3sh3LFO29KJ2x2ErdnHk=; b=rXBdCDpFf4NQjy+gHG4RG8/4tlS+Nv/tgZhxS9X/QPF+9HTh5TTHadeXfrOsFD/D1S X0rr3iZMIpC2Cx+sMLUpAB9eq+flq5PQMzX8prcLGjnYuLEJcL5YWPsIGM7cYK/elNZY vYeBRvzVtf5c8nxYJGusyxFi2xHJ5sQOcAzNbI+kEFUEFbwA+rJfKB+JEvds9ThqRlw6 mDefQM0TnBXqN5NK5qXM1Yvdxc9tfZj0benrqWy0kmCtaXwjm8EANcxXwXPdefG3Z8GD FMrtW2UyQ2PqguKwrp8yRKqN7WatlObdvc9xDbagJQlWYzqHQzta9F2eZGsI7blAM/GZ U+WQ== X-Forwarded-Encrypted: i=1; AJvYcCWGtpxh+JJ05zvS8SOFgYf71xOisK0j97hI2xyNBT1rWSDrKsnCiC9saeqe6UVRQBzKJGsyFhQwUq8WzKV9rDiKoMmFZDZEZc72xH5sXho5gNup9Ts= X-Gm-Message-State: AOJu0Yxb5OLOk7J9xORrwSkOc4vEDYLRMpkWYJaJHuSgkVn1NFyCrjDC hWLorSg4AollDzONagDTd8xDf7vXrrWmaZZJNK4zlkOPg2yaQaZivPhhYZYBiw== X-Google-Smtp-Source: AGHT+IEh0blwfOKKlbWUs8oomzyYZwweaLJ6NFxR3Gr9CI9V/VL83VlcnszoDVWX3MZ+lZ28+ZL6Tg== X-Received: by 2002:a05:6358:4b45:b0:186:f3f:3252 with SMTP id ks5-20020a0563584b4500b001860f3f3252mr667180rwc.14.1712870279979; Thu, 11 Apr 2024 14:17:59 -0700 (PDT) Received: from denia.c.googlers.com (200.234.86.34.bc.googleusercontent.com. [34.86.234.200]) by smtp.gmail.com with ESMTPSA id k20-20020ac84794000000b00434d7c4f9fasm1373362qtq.8.2024.04.11.14.17.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:17:59 -0700 (PDT) From: Ricardo Ribalda Date: Thu, 11 Apr 2024 21:17:55 +0000 Subject: [PATCH 6/7] media: dvb-frontends: drx39xyj: Refactor firmware upload MIME-Version: 1.0 Message-Id: <20240411-fix-smatch-v1-6-045f92467937@chromium.org> References: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> In-Reply-To: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> To: Bluecherry Maintainers , Anton Sviridenko , Andrey Utkin , Ismael Luceno , Mauro Carvalho Chehab , Patrice Chotard Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_141801_516728_F29B687C X-CRM114-Status: GOOD ( 16.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Do not cache the file, instead load it on demand. This makes smatch a happy parser: drivers/media/dvb-frontends/drx39xyj/drxj.c:11908 drx_ctrl_u_code() warn: 'fw' from request_firmware() not released on lines: 11877,11886,11896. Signed-off-by: Ricardo Ribalda --- drivers/media/dvb-frontends/drx39xyj/drx_driver.h | 2 - drivers/media/dvb-frontends/drx39xyj/drxj.c | 49 +++++++++++------------ 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/drivers/media/dvb-frontends/drx39xyj/drx_driver.h b/drivers/media/dvb-frontends/drx39xyj/drx_driver.h index 15f7e58c5a308..2c2fd4bf79ccf 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drx_driver.h +++ b/drivers/media/dvb-frontends/drx39xyj/drx_driver.h @@ -33,7 +33,6 @@ #include #include -#include #include /* @@ -1910,7 +1909,6 @@ struct drx_demod_instance { /* generic demodulator data */ struct i2c_adapter *i2c; - const struct firmware *firmware; }; /*------------------------------------------------------------------------- diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index 19d8de400a687..1ef53754bc037 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -56,6 +56,7 @@ INCLUDE FILES #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__ #include +#include #include #include #include @@ -11750,6 +11751,7 @@ static int drx_ctrl_u_code(struct drx_demod_instance *demod, u8 *mc_data = NULL; unsigned size; char *mc_file; + const struct firmware *fw; /* Check arguments */ if (!mc_info || !mc_info->mc_file) @@ -11757,28 +11759,22 @@ static int drx_ctrl_u_code(struct drx_demod_instance *demod, mc_file = mc_info->mc_file; - if (!demod->firmware) { - const struct firmware *fw = NULL; - - rc = request_firmware(&fw, mc_file, demod->i2c->dev.parent); - if (rc < 0) { - pr_err("Couldn't read firmware %s\n", mc_file); - return rc; - } - demod->firmware = fw; - - if (demod->firmware->size < 2 * sizeof(u16)) { - rc = -EINVAL; - pr_err("Firmware is too short!\n"); - goto release; - } + rc = request_firmware(&fw, mc_file, demod->i2c->dev.parent); + if (rc < 0) { + pr_err("Couldn't read firmware %s\n", mc_file); + return rc; + } - pr_info("Firmware %s, size %zu\n", - mc_file, demod->firmware->size); + if (fw->size < 2 * sizeof(u16)) { + rc = -EINVAL; + pr_err("Firmware is too short!\n"); + goto release; } - mc_data_init = demod->firmware->data; - size = demod->firmware->size; + pr_info("Firmware %s, size %zu\n", mc_file, fw->size); + + mc_data_init = fw->data; + size = fw->size; mc_data = (void *)mc_data_init; /* Check data */ @@ -11874,7 +11870,8 @@ static int drx_ctrl_u_code(struct drx_demod_instance *demod, 0x0000)) { pr_err("error reading firmware at pos %zd\n", mc_data - mc_data_init); - return -EIO; + rc = -EIO; + goto release; } result = memcmp(curr_ptr, mc_data_buffer, @@ -11883,7 +11880,8 @@ static int drx_ctrl_u_code(struct drx_demod_instance *demod, if (result) { pr_err("error verifying firmware at pos %zd\n", mc_data - mc_data_init); - return -EIO; + rc = -EIO; + goto release; } curr_addr += ((dr_xaddr_t)(bytes_to_comp / 2)); @@ -11893,17 +11891,17 @@ static int drx_ctrl_u_code(struct drx_demod_instance *demod, break; } default: - return -EINVAL; + rc = -EINVAL; + goto release; } mc_data += mc_block_nr_bytes; } - return 0; + rc = 0; release: - release_firmware(demod->firmware); - demod->firmware = NULL; + release_firmware(fw); return rc; } @@ -12271,7 +12269,6 @@ static void drx39xxj_release(struct dvb_frontend *fe) kfree(demod->my_ext_attr); kfree(demod->my_common_attr); kfree(demod->my_i2c_dev_addr); - release_firmware(demod->firmware); kfree(demod); kfree(state); } From patchwork Thu Apr 11 21:17:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13626565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1561C4345F for ; Thu, 11 Apr 2024 21:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=L8lCpBPySd2C55PUXZHra55jDXvRgH+G0OYV83CFKog=; b=MyLNA99/BMpegy QNRQFWniOQSOG5JUx+LZ+yr1yIv9fQdWSLoHtTQTlXvBCQtu8OIH9tMnKJVBIRcxmGRyNbKcbSLqE lnaq8/droGPRsvu58RMo+dI/JrthkPv2QSOe05A0HEsFo68BDaF/HZu8zc5UHliYHs0GCaWUlrKgO axV+rakt43YN1nTVdkeVXVyl3PlXzZVPYn1Ty+wrYc1cPPLBgzL14sAY1W2wSNb/VJu20ItsMG0L1 38M8x4P751AS8/obwxCM4UM170DtZBRa0SmR2/YTZTvRLIU3sN+E9Qf9gzLgu3KWzPauwUmQXTSKu SFLT13c2KgqxQn1Va+OQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1oV-0000000EA1k-1VGu; Thu, 11 Apr 2024 21:18:31 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv1o4-0000000E9kA-0rfH for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 21:18:06 +0000 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3c6f1c95913so51099b6e.1 for ; Thu, 11 Apr 2024 14:18:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712870283; x=1713475083; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IOIqD2cEf2Ajo/2bzueQZnF061I92Ltj+ENaeP2eHJQ=; b=Fe60KaMSrQKSDlt2iSstzEm966D67EjEG7KrYuPftbRhQ3G7bVWZdjgPRVxzmsq4pl lDsDjUl37eoj2Lj+G49rpAdUFi1C69mFMb7yPLmpOQUHZCkLJ77HqoBAat1sLjlqZ7KB +Dg+72cKONs3w3cdgHflrCIWu5hL8+j4qzI2I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712870283; x=1713475083; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IOIqD2cEf2Ajo/2bzueQZnF061I92Ltj+ENaeP2eHJQ=; b=dy9beJ6VnsLbEGBvfDgFBwnMYf1kah6s/Am8ldzHui+A+b+b0LOUkYt/VkSffT++zy Ab7QNYnr0l8RVf4kldDD0kLN8BFuqElO6YNMoekPSo/th8WdPGXEisszBDEs88WdBk7A /lYMfcvOjc4KUCGIIraSn8Z7QZ2IQY+ta8oNBITH+X72E6vxaRJMWzG59G1nOkubHv7i 4DkzbCX704qTJKDLtOgNy5eDR0ha5texJ2HjoM/BJYG8PzW0SPzRgCpCGLauGkYXY81H RyME7sWZQy3QfoN2W9PnFuGF44hueaTNAH6zPMvsPZNpVEuQqTNAkXiR2c1+jJbWXOV8 bOZA== X-Forwarded-Encrypted: i=1; AJvYcCWA0Y64q8af8/XGAny+T9UqDhhxb4pftoGzu9yhFgQnmGV7p9IG16BGW0akoXkmuUiAo5b37MygGNtXM1fM1gJF0zox2cpFs7DCXgiotSlbqDNQT3E= X-Gm-Message-State: AOJu0YzLR9bQEt7Mwq/wy67W/aZHdSkgPIi4eBrT4wr4YbkQyriUN1p4 hpBeXMgAs+yyNq00P4mS6rdpqhMvqiJUhGRMsyiXiER5iDpao+CxoyhWdg2yng== X-Google-Smtp-Source: AGHT+IFC+MhkQWiHdHFKMOyxd+8dV1gTziJ5gXLj4MpOfJR3ww+hXqqwT2lBycXPTw1zfx8RyZUR8w== X-Received: by 2002:a05:6808:198e:b0:3c6:beb:20b2 with SMTP id bj14-20020a056808198e00b003c60beb20b2mr665356oib.51.1712870281598; Thu, 11 Apr 2024 14:18:01 -0700 (PDT) Received: from denia.c.googlers.com (200.234.86.34.bc.googleusercontent.com. [34.86.234.200]) by smtp.gmail.com with ESMTPSA id k20-20020ac84794000000b00434d7c4f9fasm1373362qtq.8.2024.04.11.14.18.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:18:01 -0700 (PDT) From: Ricardo Ribalda Date: Thu, 11 Apr 2024 21:17:56 +0000 Subject: [PATCH 7/7] media: dvb-usb: dib0700_devices: Add missing release_firmware() MIME-Version: 1.0 Message-Id: <20240411-fix-smatch-v1-7-045f92467937@chromium.org> References: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> In-Reply-To: <20240411-fix-smatch-v1-0-045f92467937@chromium.org> To: Bluecherry Maintainers , Anton Sviridenko , Andrey Utkin , Ismael Luceno , Mauro Carvalho Chehab , Patrice Chotard Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_141804_395838_E769FABD X-CRM114-Status: GOOD ( 11.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add missing release_firmware on the error paths. drivers/media/usb/dvb-usb/dib0700_devices.c:2415 stk9090m_frontend_attach() warn: 'state->frontend_firmware' from request_firmware() not released on lines: 2415. drivers/media/usb/dvb-usb/dib0700_devices.c:2497 nim9090md_frontend_attach() warn: 'state->frontend_firmware' from request_firmware() not released on lines: 2489,2497. Signed-off-by: Ricardo Ribalda --- drivers/media/usb/dvb-usb/dib0700_devices.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c index 3af594134a6de..6ddc205133939 100644 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c @@ -2412,7 +2412,12 @@ static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap) adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config); - return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; + if (!adap->fe_adap[0].fe) { + release_firmware(state->frontend_firmware); + return -ENODEV; + } + + return 0; } static int dib9090_tuner_attach(struct dvb_usb_adapter *adap) @@ -2485,8 +2490,10 @@ static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap) dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80); adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]); - if (adap->fe_adap[0].fe == NULL) + if (!adap->fe_adap[0].fe) { + release_firmware(state->frontend_firmware); return -ENODEV; + } i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0); dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82); @@ -2494,7 +2501,12 @@ static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap) fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]); dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave); - return fe_slave == NULL ? -ENODEV : 0; + if (!fe_slave) { + release_firmware(state->frontend_firmware); + return -ENODEV; + } + + return 0; } static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)