From patchwork Tue May 7 16:27:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13657474 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 9EDE7C10F1A for ; Tue, 7 May 2024 16:28:30 +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=+/Yt5910Y+odXkH1kkFE9ce8p4Rhtm1vAAvEtt6lXE0=; b=olRCzKYzM1GXX2 NcJhloAkaGMqrZ4koXL4rjKlwirO4YO8EfLJOjy2/n3NseWN1aAOcu3A/Nb2fm+KuiSDOOq46TbLr mmntpqV5OKQ5R9W9659+yvzJaugqZQOCLl7C3ZRE/7lOG+gNFKH6Hpc40f00PlkEyP7RAMEWlEyZH 0DaOBpTx3+KsGROG10WD74at1ynbQ6GyKShR9ziqyY9bQgpJtcGRPaJ9SNg47OyFuG5KI+fXH/W86 ovrAz/kB7Xm9LR8CuLg5n6nzugj06Cf6M4BhLY81XOmO61X66h8FSsd50vONePShR9Hfbg8006bhB xvCzlL4hxBSFXPFD0Rmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Nfn-0000000ByL2-1Rro; Tue, 07 May 2024 16:28:11 +0000 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Nf2-0000000BxdQ-10vZ for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 16:27:29 +0000 Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3c6088df378so451358b6e.1 for ; Tue, 07 May 2024 09:27:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715099241; x=1715704041; 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=grfwfbVNg0FYwVP8zOHueia/jYu69rJdnTVnLodDO7c=; b=njKMLf/RX12jI42zcMQfBcQmjfFiJfQbnRy111n4GzQbrDeAXUME8DGtRTeEKsjjMK X7ydPMxATZ/woxY++bQqjUq8sqxPIe7v+w+9nT00em5HDSwFrD6tZ9XzxSIrxdaByxuU KIXCPUDq7enO+ImnKh4nIaU9JgccDSJfQFN9Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715099241; x=1715704041; 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=grfwfbVNg0FYwVP8zOHueia/jYu69rJdnTVnLodDO7c=; b=rMPDPdAtPpU+6jyiyP+a3HSu0RG3d8i9ty2joYpzkBL+iKyg5gtqextXaKPG7TinZN XIckBmxKZz2qujQwta94vHbruVt09R2VusrRYGJBcNHRRDHWGWd1cZQBVDImVu4nC4Lb DyRpnNfz9FMhUlg1O8ZI6JcNjstRxujWnYrqLG0uBzPXmELtthmMPRUvVgekequ/Q43j lgY5WRPizGttqT4sRgRoFX6a5ycToEJ4h3bPUJYhYxON6BZkwR/9WXgLssP7w5dJwhGK JwMKTv5hmKKwqCn528xvcikNO8Fqeey+uoj9V577G3Yip0/rsyHn0ISgwxlcsVnlX3g7 vqIA== X-Forwarded-Encrypted: i=1; AJvYcCWhXyNMRScr4b2LZwqJybbbhXsexXcQmlaxVSOljb5RKgOLj23iAkWNRNlYzawN71D5skqkT0zRAXCmPpJOuoKpZtGmOubn+SSg+fHCLOj/LrQxxRY= X-Gm-Message-State: AOJu0Yw7V5JH+fXxzA0KqovdWt03KzGlxrYRaie6PLmdy3JAHKHA2rlF FmWPUIf+hwcEG/b8Fx2n8pDrPclZ6L4s9rKJBUCFswliyqBS2cn4tePqJI2g+UqiJApbIGCLetc pLQ== X-Google-Smtp-Source: AGHT+IGh8pK0RlJouH/fYCBI41k6wvrr3zRYdR0ye3qSLW9c+wx7vH7WZyfMG13hJNctWTluPMz8Sg== X-Received: by 2002:a05:6808:617:b0:3c9:7593:7613 with SMTP id 5614622812f47-3c98529bf00mr82279b6e.8.1715099240437; Tue, 07 May 2024 09:27:20 -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 hf23-20020a05622a609700b0043d1fc9b7d9sm4160597qtb.48.2024.05.07.09.27.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 09:27:20 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 07 May 2024 16:27:18 +0000 Subject: [PATCH v2 13/18] media: venus: Refactor struct hfi_uncompressed_format_supported MIME-Version: 1.0 Message-Id: <20240507-cocci-flexarray-v2-13-7aea262cf065@chromium.org> References: <20240507-cocci-flexarray-v2-0-7aea262cf065@chromium.org> In-Reply-To: <20240507-cocci-flexarray-v2-0-7aea262cf065@chromium.org> To: Michael Tretter , Pengutronix Kernel Team , Mauro Carvalho Chehab , Laurent Pinchart , Michal Simek , Andy Walls , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Hans Verkuil , Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240507_092724_587417_154516C8 X-CRM114-Status: GOOD ( 15.03 ) 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 plane_info is not a typical array, the data is not contiguous: pinfo = (void *)pinfo + sizeof(*constr) * num_planes + 2 * sizeof(u32); Replace the single element array with a single element field. This fixes the following cocci warning: drivers/media/platform/qcom/venus/hfi_helper.h:1009:36-46: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) Signed-off-by: Ricardo Ribalda Reviewed-by: Bryan O'Donoghue --- drivers/media/platform/qcom/venus/hfi_helper.h | 2 +- drivers/media/platform/qcom/venus/hfi_parser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index eb0a4c64b7ef..dee439ea4d2e 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -1006,7 +1006,7 @@ struct hfi_uncompressed_plane_info { struct hfi_uncompressed_format_supported { u32 buffer_type; u32 format_entries; - struct hfi_uncompressed_plane_info plane_info[1]; + struct hfi_uncompressed_plane_info plane_info; }; struct hfi_uncompressed_plane_actual { diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c b/drivers/media/platform/qcom/venus/hfi_parser.c index c43839539d4d..3df241dc3a11 100644 --- a/drivers/media/platform/qcom/venus/hfi_parser.c +++ b/drivers/media/platform/qcom/venus/hfi_parser.c @@ -157,7 +157,7 @@ static void parse_raw_formats(struct venus_core *core, u32 codecs, u32 domain, void *data) { struct hfi_uncompressed_format_supported *fmt = data; - struct hfi_uncompressed_plane_info *pinfo = fmt->plane_info; + struct hfi_uncompressed_plane_info *pinfo = &fmt->plane_info; struct hfi_uncompressed_plane_constraints *constr; struct raw_formats rawfmts[MAX_FMT_ENTRIES] = {}; u32 entries = fmt->format_entries;