mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ricardo Ribalda <ribalda@chromium.org>
To: Keke Li <keke.li@amlogic.com>,
	 Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	 Daniel Scally <dan.scally@ideasonboard.com>,
	 Hans Verkuil <hverkuil+cisco@kernel.org>,
	 Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	 Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
	 Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
	 Abhinav Kumar <abhinav.kumar@linux.dev>,
	Bryan O'Donoghue <bod@kernel.org>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	 linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-arm-msm@vger.kernel.org,
	Ricardo Ribalda <ribalda@chromium.org>
Subject: [PATCH v3 1/2] media: iris: Document difference in size during allocation
Date: Tue, 23 Dec 2025 10:02:57 +0000	[thread overview]
Message-ID: <20251223-warnings-6-19-v3-1-e8f56cb204ec@chromium.org> (raw)
In-Reply-To: <20251223-warnings-6-19-v3-0-e8f56cb204ec@chromium.org>

As we get ready for kzalloc checking for invalid sizes, let's add
documentation for the cases where the size is different but valid.

This patch fixes this cocci warning:
./platform/qcom/iris/iris_hfi_gen2_command.c:1215:9-25: WARNING: casting value returned by memory allocation function to (struct iris_inst *) is useless.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c
index f9129553209922fda548ca320494ae6ae797854c..c120ea3594fb5d0f40d6b9a7c67ffc28c42109f0 100644
--- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c
+++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c
@@ -1212,5 +1212,10 @@ void iris_hfi_gen2_command_ops_init(struct iris_core *core)
 
 struct iris_inst *iris_hfi_gen2_get_instance(void)
 {
-	return (struct iris_inst *)kzalloc(sizeof(struct iris_inst_hfi_gen2), GFP_KERNEL);
+	struct iris_inst_hfi_gen2 *out;
+
+	/* The allocation is intentionally larger than struct iris_inst. */
+	out = kzalloc(sizeof(*out), GFP_KERNEL);
+
+	return &out->inst;
 }

-- 
2.52.0.358.g0dd7633a29-goog


  reply	other threads:[~2025-12-23 10:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23 10:02 [PATCH v3 0/2] media: Fix CI warnings for 6.19 Ricardo Ribalda
2025-12-23 10:02 ` Ricardo Ribalda [this message]
2026-01-14 22:20   ` [PATCH v3 1/2] media: iris: Document difference in size during allocation Bryan O'Donoghue
2025-12-23 10:02 ` [PATCH v3 2/2] media: iris: Fix fps calculation Ricardo Ribalda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251223-warnings-6-19-v3-1-e8f56cb204ec@chromium.org \
    --to=ribalda@chromium.org \
    --cc=abhinav.kumar@linux.dev \
    --cc=bod@kernel.org \
    --cc=dan.scally@ideasonboard.com \
    --cc=dikshita.agarwal@oss.qualcomm.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=keke.li@amlogic.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=vikash.garodia@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®