Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2921820lqt; Tue, 23 Apr 2024 06:00:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrbxAK+u0GAmAz561HwjMvUI3gVsuZhdA7s/YyBsyFaWEfPqB5d42ZDH/sGTDsGkGk3xoeKEyYfwpmDpsjep2s0WY9YTP3bM83hGYLgw== X-Google-Smtp-Source: AGHT+IHi/PpuV2pJtHi0uZN2fWGutWZokDjNUJDTSBK3d+uEXNPSDrLo1muulQgq5hsOjXWCKHGU X-Received: by 2002:a05:6a00:10d4:b0:6ea:d114:5ea1 with SMTP id d20-20020a056a0010d400b006ead1145ea1mr17924069pfu.17.1713877239674; Tue, 23 Apr 2024 06:00:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713877239; cv=pass; d=google.com; s=arc-20160816; b=cnO7+5q6q4N1T5Z8T8GpkLlv6hC0GrCOeA7ctij+HF8o7toMpjLqFBgzo6Z5fFsLbm 7tZudXQowzx7nutZ1Rn8iTQQDx7fKCB4PK2skCC4FCNtld7I8mjthbdF52h9E7qfNyOD yBzKqYx7RIy9BejpM7Ad6ikvaNCif3423tYfOWlQhmSGXhE+0OXEOKcuEuUroiIR9M2o 484Ax6F1ytWpAQmXu52JPSzwdR0cMjh9YNGkqDr5fKC95z63pTIGZ2rEk/YBeMHOXz27 KLY/DILih2H7065Qs5RqMLJL5ILYrb0tIpqCOeQuH9vH6LR+BUTU2O3JaRPpuB0MisWG 3BqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=+qnKAwgvBHM35XCDpuBit4GUKItb+LTK0jOfybUvb7k=; fh=a6l0Vyl8i+uj/tUU1BFWl5gfX7XfCU+J9lX5mX80AXM=; b=QkAfr850JXwyppoUd+TEr4dnu3GoSnbuZHpXvBhJ2c0zUt8S1+jzqiGXOGQiKpNVtZ kNt/E8821I+KX6+9sDlSkxTVRiW6chDI6DFU/heoBmyqPjHlZCCI0Ez/0yLzHKRnptaA HJhatdDoHyjqnv5tPMH7cJEYonDukw/R/MBE0COoWrUZwwR7kWbiZfQJoyV0wE59L93s AllmFLAyEFscNpxNFo3zWyYh0HZdGwlHavb7KAvzMF3nE1hwm+EIZpxIyY7JfSVkZf22 kDmKcTrWCr+J6XZO3Pr+D+WckBW+00A0kYUzt/6YkqRfJ1pi/AU6tlK2xsP6wjGvXpRA MfWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LsDtwhLs; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-155205-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155205-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y8-20020aa79e08000000b006ed2669d23fsi9518884pfq.135.2024.04.23.06.00.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:00:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155205-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LsDtwhLs; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-155205-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155205-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 257B4B24EA9 for ; Tue, 23 Apr 2024 12:47:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5260613BAC7; Tue, 23 Apr 2024 12:43:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LsDtwhLs" Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 1E1C21384B3 for ; Tue, 23 Apr 2024 12:43:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713876236; cv=none; b=EjuB/j5QwFfWAQ5x3bm1Gs007NzNyrQF3HAYyEmOTbRfawGxIeRt9DfmhQhc82YxK7QDq1KsjFcSZ9u6sE6N5IPqzk7Vj1ej8jxaRgjHJzsRzevnn7eAb6yK9HDvETplnaqQcJdk96WaFOOWfFMK0at5tcMl21WamSYTJ6IqBVk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713876236; c=relaxed/simple; bh=r0UmnNWiljWy3w/DWQQ7Ic6mYcT+iVhIRMPUeFTh3tM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bcvSD8eUAXgZScskmb1XsPx/NxaDynXVOXF9Cl5i6Pgzel3hFhmHC3isx+joTrUq241haNzBqP9Ih876JZswzI8355QCKdq+6pHh6wclE18kVXsyE2xJTTHc1I+NBGaR/nMEDiVm1zM2GMUZaA+sr9+czAS0ewaOc1OXAQW0XHQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=LsDtwhLs; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-343f62d8124so4518513f8f.2 for ; Tue, 23 Apr 2024 05:43:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713876232; x=1714481032; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+qnKAwgvBHM35XCDpuBit4GUKItb+LTK0jOfybUvb7k=; b=LsDtwhLsTNd6Xj4IasfsiBLv0XCxeO5W0KCfSdmEBX0mBZZ8Va5xBp6xIET1gjS1n0 KIuZyJU23Kpz2iG/R9a8ipbCFFT8k6crZEWKKeawXUwSMADN8d9hSjv6Kn5fuu3ozd9H u3NE13xcerUjPm0X6W03R32V3lvQAuxGzy6MkBMRgDqSAPtLzQfOKB0cx5pfJgA0koBR ZWx4qRcPVut3AZt9pvjdMdetMtCo6sQBBtvWE3yFHcYuouA8OSbf9Xc0jewmJ7gIdNLX 8BP5meLrW5GWUf6oH+etu9o9/8XxqoNu3vUFzhjYLxGzxlHGepwTDxp3AQxUZJIyhX4z h6MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876232; x=1714481032; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+qnKAwgvBHM35XCDpuBit4GUKItb+LTK0jOfybUvb7k=; b=HexiUwZHpMEDGhkafqLDaNZ8XsZY5PnZJYcGVhCKqUkiiiktAVkJqDQZBu7xQhqXd0 PATQM4tqEbaRbN/lIwAt7Agf+M/54w8sF738lFgSH524AL/7Ka3ny8U6LEtRLQHb+IA6 jEASZz76Fsw9v5CP5UfovnZlELkf6u+D8Rf+RDekl79YkyPnLW7yimbX8tmSMXkrwbRA Q4aWc/pVxGO058OGRDCA07R/hvL0jX8xk/FoLE/e8JCkBDsbMLnopc/GidYG/fyA//Q1 ZhVv1UKw69PVsfKU9BKBAQCwZBGoWwRJLqBeoIPq/xJv/VTIFVuE5SBwVV1q2H4hmjN/ GNRQ== X-Forwarded-Encrypted: i=1; AJvYcCXGOHbfA6uX5MWueqKmfW1hoV3+MyjpeGqB7yoqaGeib2jDIJmN49+88BaRG6cltR4pJKQ2XxM6TyD4arOF+tuMXkQpxOYPsbVcMi96 X-Gm-Message-State: AOJu0YzEjwcg5O9kE2a5t7rRusKCY9dv8mf35nW3lL6VSs2iamcQYy8j EQPteSkjfXZ5GQKptqwJjxYKa2zDEFAcF7MvmtNrt/pV1JR9kSI4WnkewSsz3q8= X-Received: by 2002:a5d:6a8d:0:b0:34b:5caf:6342 with SMTP id s13-20020a5d6a8d000000b0034b5caf6342mr2073298wru.67.1713876232556; Tue, 23 Apr 2024 05:43:52 -0700 (PDT) Received: from [192.168.0.102] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id r16-20020a5d6950000000b003477d26736dsm14506412wrw.94.2024.04.23.05.43.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Apr 2024 05:43:52 -0700 (PDT) Message-ID: Date: Tue, 23 Apr 2024 13:43:49 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 11/35] media: s2255: Use refcount_t instead of atomic_t for num_channels To: Ricardo Ribalda , Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hans Verkuil , Hugues Fruchet , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Paul Kocialkowski , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Matthias Brugger , AngeloGioacchino Del Regno , Hans Verkuil , Sergey Kozlov , Abylay Ospan , Ezequiel Garcia , Dmitry Osipenko , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio , Benjamin Mugnier , Sylvain Petinot , Jacopo Mondi , Kieran Bingham , Laurent Pinchart , =?UTF-8?Q?Niklas_S=C3=B6derlund?= , Pavel Machek Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org References: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> <20240415-fix-cocci-v1-11-477afb23728b@chromium.org> Content-Language: en-US From: Bryan O'Donoghue In-Reply-To: <20240415-fix-cocci-v1-11-477afb23728b@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 15/04/2024 20:34, Ricardo Ribalda wrote: > Use an API that resembles more the actual use of num_channels. > > Found by cocci: > drivers/media/usb/s2255/s2255drv.c:2362:5-24: WARNING: atomic_dec_and_test variation before object free at line 2363. > drivers/media/usb/s2255/s2255drv.c:1557:5-24: WARNING: atomic_dec_and_test variation before object free at line 1558. Hmm, that commit log needs more detail. "Convert from atomic_t to refcount_t because refcount_t has memory ordering guarantees which atomic does not, hence the WARNING for the free after the atomic dec." Something like that. I'll leave it up to yourself to decide if this warrants a Fixes: I don't think so myself because the previous code doesn't seem to matter to the decrement and free. --- bod