Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Keke Li <keke.li@amlogic.com>,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Daniel Scally <dan.scally@ideasonboard.com>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	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>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 2/3] media: iris: Document difference in size during allocation
Date: Wed, 3 Dec 2025 18:16:49 +0900	[thread overview]
Message-ID: <20251203091649.GA13064@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20251203-warnings-6-19-v1-2-25308e136bca@chromium.org>

On Wed, Dec 03, 2025 at 08:55:35AM +0000, Ricardo Ribalda wrote:
> 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 | 10 +++++++++-
>  1 file changed, 9 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..ab91afd0597045bd876d0411b08b5a3421b12c70 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,13 @@ 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. The first member of
> +	 * struct iris_hfi_gen2 is struct iris_inst.
> +	 */
> +	out = kzalloc(sizeof(*out), GFP_KERNEL);
> +
> +	return (struct iris_inst *)out;

	return &out->inst;

would be more readable. You can then drop the comment.

>  }
> 

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2025-12-03  9:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03  8:55 [PATCH 0/3] media: Fix CI warnings for 6.19 Ricardo Ribalda
2025-12-03  8:55 ` [PATCH 1/3] media: uapi: c3-isp: Fix documentation warning Ricardo Ribalda
2025-12-03  9:13   ` Mauro Carvalho Chehab
2025-12-03  8:55 ` [PATCH 2/3] media: iris: Document difference in size during allocation Ricardo Ribalda
2025-12-03  9:16   ` Laurent Pinchart [this message]
2025-12-03 13:17     ` Ricardo Ribalda
2025-12-03  8:55 ` [PATCH 3/3] media: iris: Fix fps calculation Ricardo Ribalda
2025-12-06  4:06   ` Dmitry Baryshkov
2025-12-10  7:23     ` 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=20251203091649.GA13064@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --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=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.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