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: 788707 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C45122E40D for ; Thu, 11 Apr 2024 21:17:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870276; cv=none; b=LxBUsuhpPAj1xwwXNJ/hYEy/oSqHT/Pu39JMlleNCSCrcM3cHpD79ZM2rs1TV7BlvIo7eu6Qk3qAizo0NpOFX3XN68B0wbVcw8fLOZ4/nGSnFgY2Qo9usGBXSqjpqLc30RtLTplQfcRDpJDGOO2S7eTOjKsfra/nKQdpecDdKlA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870276; c=relaxed/simple; bh=ulv1JL7xWZsExyNUt9ao2hlmY9qTFZqMDhceV7YHm44=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kddPEyTyuLQ4sdCqPBxl+Tc8q+6jt0kN9EONJo5GInw+/vPuOvRZgWW5YuLjJz7w6MvZ2W5slycsYwEydEcqtOuirNgFxdxmUOeedfhDxpFRlEtLENO94Q8QhdemXynVo4OAAnfV6tjPUxm71manng4OLiAdG+x79aRxX+Uspyc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=UMJglONx; arc=none smtp.client-ip=209.85.160.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="UMJglONx" Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-4347dadc2cfso1483011cf.3 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=vger.kernel.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=UMJglONx7J8e4urvd2gDSLQDRIBrZp7O+Vx3DRJ8eoB2BWOQUMOHmxIFdq4iTFbwfv cS5iPNta+LHLy3EZNaeVeYip+AHjYoiRqkKkOCdRGrDW1PhV2NrxXdLcAVC1T+UJ7HYL iNbFgxps236tOIgf31Fpjm4GAXnR+GN3POcnI= 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=YWqnlfxEcTcMUkpxXUS/lVn7NdSgRzP9wtjHAIhvGmSIOD+N8p50TrzAVjSm+vuHoY jZHkD6ZOeij8WneFomLDbhmHKE1r8zJnaFpHTYVvYhRtdENWq2aCnO9Wt45yhkJicngx GXja0XTdx6js84FX13llsPGbNmiafmEMw5+IoKIyojsIBlb6Rmq/dIx0kBcvHXuGJCMU rozpnlNiHx5QG7DM9rgmIZu9rcqAt3zQfQRM7NZdHIhZlU4vG3PFmDUIlMyL4YqBBpTU YVpXkj84Ik+SOyk8XB787GrQPe07nHanLL0Y4gyfnSe/4cnxGSJgWuPtBEcgdw1Y31GD GgyA== X-Forwarded-Encrypted: i=1; AJvYcCWu9bcN6JE0VU9VZxf+VoQ6T7TL0ds1Pyz3YUlO6oEMtL4sqoQQC9100PqwQzStfDbgzAzC+UdI+HApEjPJMv+eCw+hDGZB1i8bO48= X-Gm-Message-State: AOJu0YwPGPzlrlMmp0nK1Oix0GXAdbFOghfMK780sne/aGpM4swX7dGz ZCB8lZ5u+kJ1//jopi42+u41YDmAG4cbWq8HEOF8pzI+J7y2rstQLu0QWJvj5Q== 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 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 788162 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DB3836AF3 for ; Thu, 11 Apr 2024 21:17:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870276; cv=none; b=JENre3QknC47MmkOiOgObkJglzs0NNOIJXsVhYpWB4MO8EGGqRTHSapBnAeSundHwxOfwBZiYiBOP4QnvpRgJckHY7gt07Ub4Pej9ay0YknwPAEed5KvB7OprQNfWn5J3RTJB3GTwO0jXoSvBgULvBgRm9s8zw4GtQGSzaLy5Oc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870276; c=relaxed/simple; bh=ufd7B+p2FkYNpk8qLtjfnLDHP5pTTghrh6j0nvh6z8w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PeCe0QNCDprDBquOB5jW47jB1rMjUK2YwQCoUvU5hRA9KTdAJqQMYFET+K3z43/iuWlLn+AeAcOztU0ArtQ8u1zbWIz69u9JBxUteiM06x1ztsYi7wjOZ/oS73JIv+PlddRID/1vxFRU0AcEkG5aJhLMAYLU81/mYceS4YmMiI8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=UxxTBHrH; arc=none smtp.client-ip=209.85.167.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="UxxTBHrH" Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3c603f6eb37so88190b6e.1 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=vger.kernel.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=UxxTBHrHcEKj9qrhNBiFUPaGnqdS/+eENZ2ttbwLqITLIKri0XMmg6AKrgp4gGJhuZ EH3AOdhoM/HLqiS6kg7WC5Yh31ZKxUSvPczi2LQqpPKhH9TTCxw/oK3SUmokervwXr/z 16CGv6lHerxMx1binx3punJNY74MwyI4k0NCQ= 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=fh1BOPNp8eJBihz69qJ+aXVv8JOV9ctbx3w7cbrmaxXmDRtlz7DE56gpcMTAdsWakY vn8YUWBtxRkpa9svKEV6XaMF+7f+sE2RnYOKthee4zQts/trRJ3UK3PvwAc9xgCkS7NE xtCxzXNQEZ1e4yJdEgIDaquxlHd34RRxy557/g1hmtFPLoVij77agfd9ivIrA8ohnynh svBv66a/sshPkkoxOm4Gk9SboV5NTWDc7isUB5x6MauU54O68M9SVCqX5a7+grS/XNur 4C1X0p8KUSSr73XKoI+6NYbx5E2OHMtPZEKOT1BI5xGWm4knRFs5GtzJL7ldPkGxhpIZ yy3Q== X-Forwarded-Encrypted: i=1; AJvYcCVQ6NMCrxNjn8E77xudwWjcVZmyKii2pSkad088dfwIkcLftkQ9LCyzqq7WtKk+c0baV8SdzqBYHvQgVOZud3Z2QlBk41isdFLc1uI= X-Gm-Message-State: AOJu0YyAD7kA3ZmAOs5TFZeDn2JrYJB87lBcCkFQui8KWsoAenDnV5fA bstWeqD6TFboRxIhDxW75uyFO8ntMYSHfadC8rc1l52yEqM9ZDLWj1SP695mvQ== 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 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 788706 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B44AE3AC2B for ; Thu, 11 Apr 2024 21:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870278; cv=none; b=raN9Ni3wvwbz/VTr3cHOPWmgDw3O7js0HNykSeQ5JynJRky4Mt779g2VKGsMILrheW3nbO+gP9czpD1Nub5B5otZaBPBkV8zsLAQwL0h013f2iClhkCxAEm780xXb68d6RjDb7/8wGw/w5kvHLe0Xf4hfxVJSMa6T6+h0VCUbvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870278; c=relaxed/simple; bh=hqC8XsEkIIDvzCq8ORFwWKB0b/ku6Day+SYeCNMIfRs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y8SzUNJeLCOLZJsQgfLl4ydy3c+vxi9jdcjWMHLrE3WNk4PZ+dlcYVYlxk2MM8Y3SQS2g0w9JKhAFsccD/iGPMKMs97KAM3WELeAGgajrPaCe4ryOuzP9SuIGR9IJFJAz2VmspHV2JIAp62UhbsVNxB7xKjR/KUY9kAk4opw++Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Rn5BPnCb; arc=none smtp.client-ip=209.85.161.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Rn5BPnCb" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5aa25e99414so191539eaf.3 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=vger.kernel.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=Rn5BPnCbOscHe0u3kHyjlv9o2Jn0Zntz4D2J0C18f0NWorJ6IkhhdenO98E4uDPmyE 5BVeDPyrYzxNaKqc5SxJFosUHQfpriYOHi5VBC68RrVN/6QLTCHu/PvCG9yXF0wxmU4m guXWLU9a5FNuJnEL1g8JRJ2Cfst1eeQ23JXns= 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=Cauv1jrbc1Y6e7kX5s617B/jBlWoLYWE43Y0LpNPCaFFPOt0I+dbnCiklrRyu9q/51 PC3ttWESTuMASBdm646TQ7c4NY2sPeyJUkrRMV3LCOu3Se4SA6a8v+S/EiwlN2+/KezE GUlH8r2rmzP2XrlkbHZxgx86IYnex2LZRg0atZ6Y6qM7oWc/ixtncWz6mjNVAKjlpQ0U iwhUV4/R97a+uHzJoum/U7cQ/boQVReQz8lolSm5ryz3Og2NOPQ0XM9mDFQZVKAW7I5J DYEDaHjaoUEBMlbAT0D+frLesdGcCFFvpFXmqpSB++iuEFk/y4nJMk1gFtx6PgmxM4d1 0cTQ== X-Forwarded-Encrypted: i=1; AJvYcCWM5eU/p6V4wVHUxYxVKg62yiRsivi6mezLBFeCPtct+YEeYc+N0yiDB6sO/N57Xx4skfpTGu8XvMevwzNURXoKrY2Bj+hffdQs2EY= X-Gm-Message-State: AOJu0YxumI7PQEiDcxTSAtyZPk+D7LhjkajcnBJMD54C7x90euBEIu0y G2KblI9bASD/1EhpHQ37Marub5ArywBo6459StH63ohBp0F1TgHb36yBn5wqiw== 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 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 788161 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABF2D3E47B for ; Thu, 11 Apr 2024 21:17:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870280; cv=none; b=SGcz+4x7FN7+O+UzfMFgXs/AVyaueUSYFWuhGusl8n8OLyPhmSY8UehGCtQ3p0bZQtryDqaaO97HcQpuGFAw+L4NnPaBwW/gjwWo1bJOcYI5XQEGpK34uHKfJ7rbtm7ES8de2JVo0pa3yeMLbchY2WAfk1RCjD8ollv8Wbbn7EQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870280; c=relaxed/simple; bh=jVTlH6xfXoB6FESZXfYYk6pPpl6OaLfHd2BNU/Y9GQU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dCIqM9tbtJNczkRRdyIQVhv/7CM4LpIihEomM4iPjvil2ut3RCMRjL/wHHWaB6S4mrxOp0v4qM1T7mTJSpmZVQDHB8ZxMnl+Fbg6ioqU7utzHrM2SRccSIvha4tnuehVelJpPbhjyCdNucT/82VAVPlydtSZlMSNYic3Iau/wW8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Tc3ha5I9; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Tc3ha5I9" Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-4365c1451d4so1028661cf.2 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=vger.kernel.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=Tc3ha5I97/v6Oelp3/EyyzXlyuwIlYoEN8/V4u36Cv+ClIxOJ72jDg2dny8L0jIuqo M8c2HwBoKlo8lQecZDp6VFv8YIQMxhTd3lioZp5SPHsSnHS725uO1v5Rkg4t1Kq/Y6La DHOox7fUZaYMAf2JZiQW3G1omxGWo4EMVyctA= 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=A1AMxARe9eYFF3BMinCL+54Fpwxkda8tMZ3NOJRj+TFK4FTpDm/CCI4aCcevj8WSlS e1jYe+RUZEInjoaLm7T5gMw1MTIIdbs7vMz4mzbEeObIYhMT1GnKlZVxe5kqAzR/uq5q yTYisoE7Y6pzcvQ2CbCsYSd45R6Eg47N+GZOftVo84WH2hSTq1PDOUEOvipcMFN75+Ku Byx7/QQ1QdplGQHueagG1aoV09F02LinVvNqAbt7TL0DdjX4sohAOilrRQIZWvdqdgR+ IX12zJAa3ohWcFS/Mm7Ljwm3s4vZqeoTuWNDhub1PyFtn7+TIb07O/7KTP90LDLA5kzU zxWw== X-Forwarded-Encrypted: i=1; AJvYcCWVPVQyhpCP3pudusH7o8hEgsExtFsogEdjaWOttUrfAtNbSDMb8wRstU3vIi59nkIWG9QbXLSol0XQWgt+gw/lt92WJDK/kjnP9jY= X-Gm-Message-State: AOJu0Yxa5d3mbCpjtFFqhYMBy/qEVcrZEeenCfVjgfqA2b7YpfLSwBXR 0Z7J1oARzgTQ1WmjEQmPWPUcVRxCkJM4bT2W54V+Lc7MfQjVEP5vA2kqbsDtnw== 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 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 788705 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35BB13F9F9 for ; Thu, 11 Apr 2024 21:17:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870280; cv=none; b=YfJntdTeO73XZ+wtJLEh8L3SoSoVNfjXlJsGQgJxsJXQzJdwhqfUJ21Fa4nJLN0wEAHyS151/qsTMBjfn+U107v/QDoCgRX8B6c2HUIZkZKYoDv3Vyu4A8Bb5q/UGkKnP/aQOFvZVHnS0rk9QlzLuHIgNC/cnOLIB7oDWc9HpBY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870280; c=relaxed/simple; bh=dp4RMhErGFhr4bpB4GWRG+LeS25vv/r3I5ywr16IJEQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z9I2ayxoPzDDxjdjdejGzKDXavver+f/Xgi2lDww39gVhMdKdy1phWPlz3JINTxD15ZbWTSSJJsu4nDQIJAZrwHwgWX1FvuHHil71R0RYDnjg8K3lzGws9enGPY4ZEWDN0DY99Se8USWdU+wMzsbP7yrFWSQvm0cLDDHPDDhV4A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ntrkH0K0; arc=none smtp.client-ip=209.85.161.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ntrkH0K0" Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5aa12c21ff4so183009eaf.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=vger.kernel.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=ntrkH0K086JJwfBHvGT5bb5VuGHKzxCZeV+zfZjg9H/AZdpOIBuvUBnFqqiE4Gzdu7 /TfWC86WGODUY5y7LbE5XimrOgNAg9qwRaxzK0yDKN8yikvlUcZVfXOY+I2MDtbohfKx sKuEWleuiHBybEx64rdHSYKamoQK0IgBIAqYY= 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=CCirKVXavD/NsW1qLPe1vJDKiZsZuoUvoBcobxUmu6lqskiuc4yCg3CYYOGtAkL/rP tXLzM8S952czr0a122aDCQAhNQwh4/AjIqopa8fCwN6kmHS6hpGEA29d7kwXKJXL4jQU K0zxVDhUjgZYrGLhQe2C6mVkF1kFPmiI+NLbEBPEy5Pn9jmoctywTLx9eFfBmLEEMb6C BMvwJuMKmL7ptMXCDG+O+wYslpkrsdSxhR0hZn/nDidSCqhxq8SBrUkbNqFKEb9S9t6Q eLTkP04AcMS56O5WsxPPzdqJsgZ3wyufVNhYi2l67cYAochmBInMqlu+MnWh1/hwiLjB JRpQ== X-Forwarded-Encrypted: i=1; AJvYcCWZ43psn+Bvd4EKa9lj0pzYwSUjUUH277P2jZPXJVexjTG+JYwFfDh9ZI71Yla2WIWd3NK2fZOaCB9v4VK0DqChP6ilsDDyhd9O6Rk= X-Gm-Message-State: AOJu0Yztq+3Le189yqHVwUV44RLSfFrL/a0eb2uDYP+4TwR+ZXVK3uCu lwMrWzXi8Fgy3aOOP6GnZmHqmnb/V1uiF1StCa3vnyhGu/nsn8gsKa0zkzbW1Q== 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 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 788160 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F04DF4174C for ; Thu, 11 Apr 2024 21:18:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870282; cv=none; b=ScUlmZ0XXv+Vr0SCXLwRArUFGupZ31QYJvuH+FzbzatJc5fzA3Q2cu3sAneM/ga3oXqzjRCLMhcqRJLZQR9x/VBDZfOHnXzAoT7j19FQGN8Kvy5IT7l6Q2TLd7sLAm5UXwXner8Qvk4LqSkVpuy4UuFxPJLxihh6UlrDPOTsEKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870282; c=relaxed/simple; bh=Ogh+hSh4Or5uPuB9tfRQOhwkH7pUIRHWmEF19NCyWzA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t0cqE7wN9h8ID7WZgW10RoW9HrKAiNPgKh8HUJJAJSL3Q8TB1z3QEH2hd1mDge31lm6H2ehL0aDfnQO9jSGaQp6Wmqp5HtLwYecPQ+ctUgC0p4raDzkjIW6pGqyUxPgtwP5UciXbXqqHbvILBTgaAkBs3NU89qu97Y+3wri5eB8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=OR3RTLBD; arc=none smtp.client-ip=209.85.161.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="OR3RTLBD" Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5aa25e99414so191574eaf.3 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=vger.kernel.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=OR3RTLBD8M6HjvxKqQsArPSGRNkTaTccLQxASsqwwgk10DQFBL1f00ZYJq6qZEPWRn +/9KPeOmghux+xSZjoJZtiJWkd3UnceAQSRastwyRf+TRN9KLg7JtzpoiqG6jDn8cnVO 929Kd8wu+awJ27msuRO8KN1r/IR82+UXECqR4= 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=RrGWfk46xDT728Uuj2ccI/ECm0Of/Ne5Vy+QJ+5BKP4MtMmG/QrigwmVfbjvwzoXqr 6bFDeOv3uipfBq5TZn9Tc7FGYyb55JwK+TJDJufVjxnF7boOAPEvtshRogdu8QTFArSe vtUg5ouZZ0NPaVia9CJm9yUfddN/OZoBNMUFVWJxx7g0OIYXsCpJiZhT0gTVEttEfNAG 1Zg8rVJtjfYEWUJ3VcwSYnyD501ovX3frG9o4PEtkdIOEOhEhsFtGpNs9EO/FoBz3mw1 c7hF20UFsy+F1dnoL3DF8oZzt9FXuRBkb9SBqxuq5DSb3i13gardLirvDsVBxYyVnYrg PSiQ== X-Forwarded-Encrypted: i=1; AJvYcCWCtgwaUP1qvUpQEYnVbj9bv7pqCYS85QlMKAWod8r31qgpOMzLFOk3XwIB/qFNVNUD4RqqdiKGbQN9A+8FC9vhRiADNy0aeG1XH7M= X-Gm-Message-State: AOJu0Yy7ql333U2kxBZFJGu5Fn6GetMASINoYsbcJ+TJHkJzrm/fYRYD HJ7hZXawxuVYqpA5SN/9kCS2kF1ESvMvVnpXErQ/Omten78+NAIpI3d36MS5zQ== 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 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 788704 Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAEFC4597E for ; Thu, 11 Apr 2024 21:18:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870286; cv=none; b=AObvppc3NarOOECf10hFqBdoPLw0CL11uD+cWwy2fiwcFUvzRxy4Sx+L+/F0YUtw99NsJ2ihH+/9Cz4+VTfvBZQETcBdZasvJ/h/sgkCUc92QTM5s+CzhiZtq2GLu+25vHu3CWqjvSRlQ5UxGFYbqawWD1Wq/7k/CWLu8fliHdE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712870286; c=relaxed/simple; bh=jWvovnNbCjwB2C+VXHGftHmA5T8gil6/DHr34mWgtoE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NsLovdG32WPzdqjNRy7U+KLFYk/sMMvTU6aF5kHFJt0L39XIsPaXNLXqV7GxkRbqCc3pL8vGkP6ZM5IJKNtz5zOqvEwaVsmzQICddm8QGDTveoNUDOmtFuPYw/wC9gQvL+F/i1hJfilcUN302gSBAeEENWep883nTImi/Hdx3Fc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=bCxvtOHZ; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="bCxvtOHZ" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3c6f1c95913so51100b6e.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=vger.kernel.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=bCxvtOHZLkuithzlYNA0ADaPlt5s5uEzOGaLTqUGhjnH1nblKRIXwclN4Op6w0MTmm qI1AXJrRWIM9jOMCWxAAUaLwUBlp7XJO0RAvONF4UzdBg9G1qjAsjvCHLGUJKd8VFhJ7 COLjgMLLu8TywhN5x8AomQ7Zrn6UkNvhlZ0uc= 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=qoVSJVYQ+xlTn0e/f1QAsIAiHtNYYPAQu1Wq4sjspEpmy+xrQUxXjoo7uD/LXr2Lsr jKPquS0kCwuxQ792RVRlMlLvoK1BxmLxHCTRpfLMduUqjYUJkHiK0L9q8Hv5IDqVBA+5 B++hWioRl0n/4/4btE3oqFTMjm2cblALEWJ8HShkU7IdXuaLplmOBiO6ze3wdrMdBrAu tA1j0cAzi+fRpMg1KSMt/ipsXyw2xmRjRx8t96hFBEYqBjPOLyPeXgAbkXdkN1Ov+TVJ LPPNznuEd2TRxhedJA8q0D0RRuBG09Dcnd3FtvE0TWf9eS+qajpRKfRiCONVdCt/pmhg ja0A== X-Forwarded-Encrypted: i=1; AJvYcCVP1s+fPQPCWoyu9FaJGUn8l05yv+bT/vfcNFYthUa6yBZiGOFjjh6Ao85KJgJ0EoeU6JM73PNEatMUXdKClMMTZj52G1ndGg0mtJ8= X-Gm-Message-State: AOJu0Ywzn4coOdyzlssWntNnMyyJVGeuYMxoxJ8Bbhi4d6aZ8sUV8SMu ZLZmEkAiLCLI6V5uvTzx5B4DIyD7tTaPkXgdXHeJO7vl1FN4dd8PTqDXLScRqg== 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() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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)