From patchwork Mon May 27 21:09:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13675833 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 94746C25B79 for ; Mon, 27 May 2024 21:09:55 +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=yBvOfDnHBuswJBwnYOBJbkHSccQzSTxKl4ULmkGHMmA=; b=0GIdNFjgG/O/uT 7JyQmJvJ2oBUE1sq+qvfgXTxOeUrlVPPI2/dc6ABQEgRMGacQt8bXRtzfa1CkP4kzs6C6Lo3g7Jxa Jbb1ORy3rVSYa3FK0ShNR0HGvakgx5peo/A0HwpIa94rn5kQ50I8jGuevKSYzglrWz71LcDtVSzHe RcvI9fnkpj7BNaz67/ODnnwsrjMl9p5l0DVQEBeLbStOk0S+3LqnjfOMuaQKqxNLnq2YgYq+0hcHz 3Ct0OKQIqo1bHXRbV2e7+0FfQYingygG4Zqn/x6l6gSG1Sx4Uypy+K4BzTSZHVwmEe2uo2S1QbOMH cMH30lZu0CW4G8MDJPdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBhbE-0000000GKhv-3Hnd; Mon, 27 May 2024 21:09:44 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBhag-0000000GKBp-4BUZ for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 21:09:12 +0000 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3d1bb1c3b74so105015b6e.2 for ; Mon, 27 May 2024 14:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1716844147; x=1717448947; 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=wbbB0QGbRD56aYsaD+Y+ZEPd95SUig7FuxMvDlZcWEM=; b=DPE/RF4Ya0kI7uc6J4fYUXURqVDwRQJQocy+hGYr0oi9YyDzyCUyFnIcAkPO3LtqUn cM5lRrAN9zD9R82C587e9HrS0ocZtMBzlELZ91nc80Q+s3yasfSl3Z0WpdYIWlHJBEW7 9XphCx7xUPpUhry65tv4gAJz1pBfHwINtmFK4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716844147; x=1717448947; 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=wbbB0QGbRD56aYsaD+Y+ZEPd95SUig7FuxMvDlZcWEM=; b=lxAmeL/RyKcqDdxoPMgFVf5ciD6Vwuo4Hun+nUToQaH0WDXkuECX1vcrGSnvhvco4G qqHJSyaiAtQcsag8aB7tFml5/OpXHsD4QPnXIv9G351sfsokc1pRN5dtYeQ2+04NiGVX 1J8CxzeiLCdUdM0MvrgeJMxtdCJKwX5eGpAnWhWx6VnVI6pPAGABJwxxOxVjSFhr91Xq gQmHSNdzC6lLETz5gNwLNak31UabF9pQEE+nx36IKSjKMoGv1QgwpwdZ0M3+ddoJsRic satKYR26GTPXfRCxURRuvjq3DyOcqOo5J5Jv3+MBYqqUPddHW5SQAG4TfB72uRSNgU+9 Ek/w== X-Forwarded-Encrypted: i=1; AJvYcCVTI2PWRgj/HW8SW2htVYyPX72bAGdlHBQX1gZcIvhMg6BWN8nvXc0iKRlXPYrBJxmLarssvS6hokRLflih51QjOij2is85lmEqBrYdgrBz3bNdmhA= X-Gm-Message-State: AOJu0Yz2HWM29wepstO+viivSnCB6hS1MH4vvuQjHGpnBDMBNLEp0Zu8 olkavNQxvD36YszulgGC0nJkK9p6E8c5KbHGCO41vY1oleUp2TC8XaVNO68JQQ== X-Google-Smtp-Source: AGHT+IEnIyO0WIHMxuiEtYRurphYM/ASsB5F423fmVs+Mw1AhNj6jPPmJvmyuQNG+kiC5cStpK/OGg== X-Received: by 2002:a54:449a:0:b0:3c9:7a7b:a7cd with SMTP id 5614622812f47-3d1a91908d4mr10056024b6e.51.1716844147133; Mon, 27 May 2024 14:09:07 -0700 (PDT) Received: from denia.c.googlers.com (125.135.86.34.bc.googleusercontent.com. [34.86.135.125]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ad850a6dc7sm9511866d6.93.2024.05.27.14.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 14:09:06 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 27 May 2024 21:09:02 +0000 Subject: [PATCH v3 12/18] media: venus: Refactor struct hfi_session_get_property_pkt MIME-Version: 1.0 Message-Id: <20240527-cocci-flexarray-v3-12-cda09c535816@chromium.org> References: <20240527-cocci-flexarray-v3-0-cda09c535816@chromium.org> In-Reply-To: <20240527-cocci-flexarray-v3-0-cda09c535816@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-20240527_140911_136673_FE41D007 X-CRM114-Status: GOOD ( 15.30 ) 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) Reviewed-by: Bryan O'Donoghue Signed-off-by: Ricardo Ribalda Acked-by: Vikash Garodia --- drivers/media/platform/qcom/venus/hfi_cmds.c | 4 ++-- drivers/media/platform/qcom/venus/hfi_cmds.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c index 3418d2dd9371..75f4a3d3e748 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -402,7 +402,7 @@ static int pkt_session_get_property_1x(struct hfi_session_get_property_pkt *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->data = ptype; return 0; } @@ -1110,7 +1110,7 @@ pkt_session_get_property_3xx(struct hfi_session_get_property_pkt *pkt, 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..f5708fdfb197 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.h +++ b/drivers/media/platform/qcom/venus/hfi_cmds.h @@ -191,7 +191,7 @@ struct hfi_session_resume_pkt { struct hfi_session_get_property_pkt { struct hfi_session_hdr_pkt shdr; u32 num_properties; - u32 data[1]; + u32 data; }; struct hfi_session_release_buffer_pkt {