From patchwork Fri Apr 19 09:47:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13636029 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (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 385327BB07 for ; Fri, 19 Apr 2024 09:49:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520162; cv=none; b=oWb+WMl84myNJVzjhCyxKZEdP2Qd6JSRQfNpCz/CcXKRmbdGnPg1WZSCR3+xTujr6jYdVRDst+UFRzTuvu4QjyU+xwBSH+GAyTbIHS2OaVBy0Z/TIuXB675rpO5AXX/i2rZtalzs5WjTVJK1cjGgCDBoN1LDWrWl0s4n65rnTUA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520162; c=relaxed/simple; bh=pKDV/DDljfYbyJBEoKPsy5J2SxcCvPCQTO74udVktBA=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=NBt+PdMCl8Lid79jl6jATh9z0ICOjKafsstwnGOQhwiu3Y+rf4CpTQd0Ixxypf1ae83UdjsTf6RwG3tVLetxXsLN3Yv6+zBTxjTNeVvKq7FW7suppmIM/bpF6gN8Ykt5tm2NS1exTkgOws0Ze65L/MbxcOmO0pjOfz6Bvb7R/PU= 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=Idfbl1l6; arc=none smtp.client-ip=209.85.222.169 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="Idfbl1l6" Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-78d62c1e82bso124684085a.3 for ; Fri, 19 Apr 2024 02:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713520158; x=1714124958; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=cRNZApPOWNGUw9rh6uD/J/LwtHi/yERWjgUEfHZaap4=; b=Idfbl1l6Bz8rBtDI/g5CHK5dcpqZcXJSkObZTfqMpExfgp9orquZpn7wc/v3hMmPfI HtlvRYCkWQomDW7iiWg8NkG4rmfoA0N1cij5+HYu0Td4s1SG+kbTC27pBXLvUWbcntvm sOtEgfIKf6+u3q6TIxjF7U4HoroB2CttxP10w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713520158; x=1714124958; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cRNZApPOWNGUw9rh6uD/J/LwtHi/yERWjgUEfHZaap4=; b=a48tgEySh2jHxF3VdQfDu8z8Cs0d7YvG25CB2OFgd5g0cddRX7YM3IH9hST8DOcyzO za6UVgMC/L/pQRixd/uipnweaIRXs5FuGF6LE/rtvh6mTbHpVuuZqnAPbAuJmyxAlkfG fo8T3OzL0vRuWs5T5R9IRo3nuMF5Y3CyQZACMJkOKryvFGzvvQUoCk2BtZ7wkDq5SQK/ HMYrfRNvVASbWzp3SOxznRcKg3YmZfsHuLlD5IIDiXs2X2NAAKApaVH17NZ4CjyfF7C7 sM72ix4NoAEgV6tBaCaNxQVeiyg02WiHENdjq/EzWli2jtyUZo1oWtl0/149o7V6t08v qQlQ== X-Gm-Message-State: AOJu0YwcnlDT/yiBMLMjC9HEBHbHpo/ClhV0mx5dB2HaxVA/OcQ1XUnw nyfvOvSctPIDXXzwJOCthXN1+JQYLpSAqr4m/dxOKvBWfRWqeTLMUA4mYwRRb1BT5VtWDoEjN6x J8A== X-Google-Smtp-Source: AGHT+IEwFEqraeOqWxkPQAAFkUs5oWfyDBRxF4A8wk2qhAECZd6CFNAdYxUvmXxXTuoou68/E0VA+g== X-Received: by 2002:a05:620a:5a4f:b0:78d:6c05:b498 with SMTP id wx15-20020a05620a5a4f00b0078d6c05b498mr1754759qkn.14.1713520158006; Fri, 19 Apr 2024 02:49:18 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id dt14-20020a05620a478e00b0078d735ca917sm1434532qkb.123.2024.04.19.02.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:49:17 -0700 (PDT) From: Ricardo Ribalda Subject: [PATCH v2 00/26] media: Fix coccinelle warning/errors Date: Fri, 19 Apr 2024 09:47:46 +0000 Message-Id: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAMI9ImYC/22MQQ7CIBBFr9LMWgxMUYwr72G6oBTKLFrMoETTc Hexa5fv/5e3QfZMPsO124B9oUxpbYCHDly06+wFTY0BJWqp1UkEeguXnCOBU+h9QLTnYKD5D/b t3Fv3oXGk/Ez82dNF/dZ/laKEFNoYG0bsDV7Gm4ucFnotx8QzDLXWL2eD/W6lAAAA To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , 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 , Benjamin Mugnier , Sylvain Petinot , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio 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, Ricardo Ribalda , Sergey Senozhatsky , Kieran Bingham , Dan Carpenter X-Mailer: b4 0.12.4 After this set is applied, these are the only warnings left: drivers/media/pci/ivtv/ivtv-fileops.c:223:4-10: preceding lock on line 267 drivers/media/pci/ivtv/ivtv-fileops.c:230:3-9: preceding lock on line 267 drivers/media/pci/ivtv/ivtv-fileops.c:236:4-10: preceding lock on line 267 drivers/media/pci/ivtv/ivtv-fileops.c:245:3-9: preceding lock on line 267 drivers/media/pci/ivtv/ivtv-fileops.c:251:3-9: preceding lock on line 267 drivers/media/pci/ivtv/ivtv-fileops.c:257:3-9: preceding lock on line 267 drivers/media/pci/ivtv/ivtv-fileops.c:272:3-9: preceding lock on line 267 drivers/media/pci/ivtv/ivtv-fileops.c:598:4-10: preceding lock on line 627 drivers/media/pci/ivtv/ivtv-fileops.c:598:4-10: preceding lock on line 689 drivers/media/pci/ivtv/ivtv-fileops.c:606:3-9: preceding lock on line 627 drivers/media/pci/ivtv/ivtv-fileops.c:606:3-9: preceding lock on line 689 drivers/media/pci/ivtv/ivtv-fileops.c:648:3-9: preceding lock on line 627 drivers/media/pci/ivtv/ivtv-fileops.c:648:3-9: preceding lock on line 689 drivers/media/pci/ivtv/ivtv-fileops.c:692:4-10: preceding lock on line 689 drivers/media/dvb-core/dvb_frontend.c:2897:1-7: preceding lock on line 2776 drivers/media/dvb-core/dvb_frontend.c:2897:1-7: preceding lock on line 2786 drivers/media/dvb-core/dvb_frontend.c:2897:1-7: preceding lock on line 2809 drivers/media/dvb-frontends/stv090x.c:799:1-7: preceding lock on line 768 drivers/media/usb/go7007/go7007-i2c.c:125:1-7: preceding lock on line 61 drivers/media/rc/imon.c:1167:1-7: preceding lock on line 1153 drivers/media/pci/cx18/cx18-scb.h:261:22-29: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_cmds.h:77:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_cmds.h:85:5-16: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_cmds.h:154:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_cmds.h:171:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_cmds.h:180:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_cmds.h:189:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_cmds.h:201:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_cmds.h:220:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_cmds.h:230:5-16: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_helper.h:764:5-15: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_helper.h:1008:43-60: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_helper.h:1014:36-46: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_helper.h:1041:5-15: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_helper.h:1088:39-51: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_helper.h:1093:5-22: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_helper.h:1144:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_helper.h:1239:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_helper.h:1267:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/qcom/venus/hfi_helper.h:1272:4-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/common/siano/smscoreapi.h:619:5-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/common/siano/smscoreapi.h:669:6-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/common/siano/smscoreapi.h:1049:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/common/siano/smscoreapi.h:1055:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/dvb-frontends/mxl5xx_defs.h:171:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/dvb-frontends/mxl5xx_defs.h:182:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/allegro-dvt/nal-hevc.h:102:14-22: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/media/platform/xilinx/xilinx-dma.h:100:19-22: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) drivers/staging/media/atomisp/pci/atomisp_tpg.h:30:18-22: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) CI tested: https://gitlab.freedesktop.org/linux-media/media-staging/-/commit/055b5211c68e721c3a7090be5373cf44859da1a7/pipelines?ref=ribalda%2Ftest-cocci Signed-off-by: Ricardo Ribalda --- Changes in v2: - Remove all the min() retval, and send a patch for cocci: https://lore.kernel.org/lkml/20240415-minimax-v1-1-5feb20d66a79@chromium.org/T/#u - platform_get_irq() cannot return 0, fix that (Thanks Dan). - Fix stb0800 patch. chip_id can be 0 (Thanks Dan). - Use runtime (IS_ENABLED), code looks nicer. (Thanks Dan). - Do not replace do_div for venus (Thanks Dan). - Do not replace do_div for tda10048 (Thanks Dan). - Link to v1: https://lore.kernel.org/r/20240415-fix-cocci-v1-0-477afb23728b@chromium.org --- Ricardo Ribalda (26): media: pci: mgb4: Refactor struct resources media: stb0899: Simplify check media: uvcvideo: Refactor iterators media: uvcvideo: Use max() macro media: go7007: Use min and max macros media: stm32-dcmipp: Remove redundant printk media: staging: sun6i-isp: Remove redundant printk media: dvb-frontends: tda18271c2dd: Remove casting during div media: v4l: async: refactor v4l2_async_create_ancillary_links staging: media: tegra-video: Use swap macro media: s2255: Use refcount_t instead of atomic_t for num_channels media: platform: mtk-mdp3: Use refcount_t for job_count media: common: saa7146: Use min macro media: dvb-frontends: drx39xyj: Use min macro media: netup_unidvb: Use min macro media: au0828: Use min macro media: flexcop-usb: Use min macro media: gspca: cpia1: Use min macro media: stk1160: Use min macro media: tegra-vde: Refactor timeout handling media: i2c: st-mipid02: Use the correct div function media: tc358746: Use the correct div_ function media: venus: vdec: Make explicit the range of us_per_frame media: venus: venc: Make explicit the range of us_per_frame media: dvb-frontends: tda10048: Fix integer overflow media: dvb-frontends: tda10048: Make explicit the range of z. drivers/media/common/saa7146/saa7146_hlp.c | 8 +++---- drivers/media/dvb-frontends/drx39xyj/drxj.c | 9 +++----- drivers/media/dvb-frontends/stb0899_drv.c | 2 +- drivers/media/dvb-frontends/tda10048.c | 13 +++++++---- drivers/media/dvb-frontends/tda18271c2dd.c | 4 ++-- drivers/media/i2c/st-mipid02.c | 2 +- drivers/media/i2c/tc358746.c | 3 +-- drivers/media/pci/mgb4/mgb4_core.c | 4 ++-- drivers/media/pci/mgb4/mgb4_regs.c | 2 +- drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c | 2 +- .../media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 10 ++++----- .../media/platform/mediatek/mdp3/mtk-mdp3-core.c | 6 ++--- .../media/platform/mediatek/mdp3/mtk-mdp3-core.h | 2 +- .../media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 6 ++--- drivers/media/platform/nvidia/tegra-vde/h264.c | 6 ++--- drivers/media/platform/qcom/venus/vdec.c | 7 ++---- drivers/media/platform/qcom/venus/venc.c | 7 ++---- .../platform/st/stm32/stm32-dcmipp/dcmipp-core.c | 7 ++---- drivers/media/usb/au0828/au0828-video.c | 5 +---- drivers/media/usb/b2c2/flexcop-usb.c | 5 +---- drivers/media/usb/go7007/go7007-fw.c | 4 ++-- drivers/media/usb/gspca/cpia1.c | 6 ++--- drivers/media/usb/s2255/s2255drv.c | 20 ++++++++--------- drivers/media/usb/stk1160/stk1160-video.c | 10 ++------- drivers/media/usb/uvc/uvc_ctrl.c | 26 ++++++++++++---------- drivers/media/v4l2-core/v4l2-async.c | 7 +++--- drivers/staging/media/sunxi/sun6i-isp/sun6i_isp.c | 3 +-- drivers/staging/media/tegra-video/tegra20.c | 9 ++------ 28 files changed, 84 insertions(+), 111 deletions(-) --- base-commit: 836e2548524d2dfcb5acaf3be78f203b6b4bde6f change-id: 20240415-fix-cocci-2df3ef22a6f7 Best regards,