From patchwork Tue May 7 16:27:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13657469 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 AFA5EC25B4F for ; Tue, 7 May 2024 16:28:15 +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=z/FRoWxHms4MsWOTS+cPrZpjxWrYPm/tPR1ciC0aCZ4=; b=SUPHDFe8igCyWV P8Gi/i6S3Xxa2u6wiWga/yZF0CFh1vewddioR73rmfoGOOCq9T3zaB3jIzV4VwEmIqEbTvC0bZlyx uvBIph6Nw6KYHzzu+Gdu234EnM5crVrxlnlLz3wITXYoQL19gMm9+3CxlhC2RyCnBQcO6W0txq18p yUeyajusTMPTKT0QBnvryQTGzzoGzHYHKPMCD/BczRJF+6Gxspfhhv8e9+sXz4lbUDYB55Tl5vuST wH0PtpkBXZdwAQWn1P7F3l5PpSCl3yxpZNSFTEyCH8sGPsjdxHNS7qRcvRXqnXz2tat0+rLJ8V5PH onVTc8Nb4AFkFQVHWH6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Nfc-0000000ByCE-2Leg; Tue, 07 May 2024 16:28:00 +0000 Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Ney-0000000BxbK-2urV for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 16:27:25 +0000 Received: by mail-qt1-x82f.google.com with SMTP id d75a77b69052e-4349685c845so19822131cf.0 for ; Tue, 07 May 2024 09:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715099240; x=1715704040; 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=1Dzq1v7dj+VBVNk1zZzFNzIZj2cxfHYcizI+MBp1ZX8=; b=IlX13k0va5v+er7s3Rvwnsr8qXhc4QtcXtXm5v3DuORNFNqjSYOoCWgW++1cnZY+NA dQL7r3TFSaJLBO2r0ZQjZIcUQgd5T3NW9S1BT8hbmN82bXm0WTWE42MooIMGBPKX4zXe yx95aD3WCUftBdVbDIWAkZtfsq9vYlU54a3tE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715099240; x=1715704040; 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=1Dzq1v7dj+VBVNk1zZzFNzIZj2cxfHYcizI+MBp1ZX8=; b=nCyay//2qhIAoo3E+1nRV+MMSGExvVPdZGBE1rfK4Y9LypZTVOAGS0BZHrlaMROIn/ AfOEqwRce1xBQtbtN4eKBA3mjbCLi2Mudb4NNSUD/pKZU3HZxe5eUvwfe4zbpZWxB9LZ mvm37pvYr0+50ixhSCXKf3VoApXpxYuqzznK/w+Gu+Ev7gPIxEevsE10GM8heX7zz7B3 kINcKOtlza8z+a1V+QISzNoE9mWphvw+24VvXoyv066tXMM7ragXtq5yo/ljwK+/eqWl 9KiJ9HtzKeWCoBAMPPtzbIPmZ5q4RTIQvDnNgakeZ9EivWulrj0aqd362UYZdRs77Hxo sQFQ== X-Forwarded-Encrypted: i=1; AJvYcCUfJ5XjNYWfJ2AhdNCdSdEWatmamEosJ90J/I/tIrl5XO/kvreQJEMmLBz/E2boR6Gwcq5ShVkeEsiCZYqZ/HsT6EKiPDCxGWQ6jzyS8qi9ZA2XYcE= X-Gm-Message-State: AOJu0YyFktZCYeO1rBTFOXNW1BF3Gwv26Cyx4AyKQ9HnqmGRxpkSLbwt rjsd45jxZuvjIcqJpYGB3OlyAwycyOQ0h/Fgg5GGjlMnFUn/0H0U7SD+dsCUww== X-Google-Smtp-Source: AGHT+IHXb5fqM0+WhwYErzB4YNZEKLztS54+R7oGh+gtQ5dv4ZRmegXN7RcfrH/DsD9yhahUSJeC+w== X-Received: by 2002:a05:622a:50a:b0:43a:829b:a32f with SMTP id d75a77b69052e-43dbf754b18mr1904941cf.66.1715099239735; Tue, 07 May 2024 09:27:19 -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:19 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 07 May 2024 16:27:17 +0000 Subject: [PATCH v2 12/18] media: venus: Refactor struct hfi_session_get_property_pkt MIME-Version: 1.0 Message-Id: <20240507-cocci-flexarray-v2-12-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_092720_965292_6E0C041E X-CRM114-Status: GOOD ( 15.76 ) 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 struct hfi_session_get_property_pkt is always used to fectch a single property. Make that explicit in the code and avoid a single element array at the end of the struct. This change fixes the following cocci warning: drivers/media/platform/qcom/venus/hfi_cmds.h:194:5-9: 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_cmds.c | 8 ++++---- drivers/media/platform/qcom/venus/hfi_cmds.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c index 3418d2dd9371..520ff8a587e6 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -401,8 +401,8 @@ static int pkt_session_get_property_1x(struct hfi_session_get_property_pkt *pkt, pkt->shdr.hdr.size = sizeof(*pkt); pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_GET_PROPERTY; pkt->shdr.session_id = hash32_ptr(cookie); - pkt->num_properties = 1; - pkt->data[0] = ptype; + pkt->one = 1; + pkt->data = ptype; return 0; } @@ -1106,11 +1106,11 @@ pkt_session_get_property_3xx(struct hfi_session_get_property_pkt *pkt, pkt->shdr.hdr.size = sizeof(struct hfi_session_get_property_pkt); pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_GET_PROPERTY; pkt->shdr.session_id = hash32_ptr(cookie); - pkt->num_properties = 1; + pkt->one = 1; switch (ptype) { case HFI_PROPERTY_CONFIG_VDEC_ENTROPY: - pkt->data[0] = HFI_PROPERTY_CONFIG_VDEC_ENTROPY; + pkt->data = HFI_PROPERTY_CONFIG_VDEC_ENTROPY; break; default: ret = pkt_session_get_property_1x(pkt, cookie, ptype); diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h index 6dff949c4402..e1dd0ea2be1a 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.h +++ b/drivers/media/platform/qcom/venus/hfi_cmds.h @@ -190,8 +190,8 @@ struct hfi_session_resume_pkt { struct hfi_session_get_property_pkt { struct hfi_session_hdr_pkt shdr; - u32 num_properties; - u32 data[1]; + u32 one; + u32 data; }; struct hfi_session_release_buffer_pkt {