From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC803346AD5 for ; Wed, 7 Jan 2026 14:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767796270; cv=none; b=o/Dt6DAAHIjDqg+haFWAVqkEZ/TGzCB/JiMDfKFKX8qHoUfc22KzaR4DFUkuX4Lhgayh8t3UnWoNPMGEwj1bvz6rp5QWMXHdBotHcRMA5p0aT9jRGNIT6yluVVDfRulu+YRjVSFw8TgK8VeCHYcZcWoSvbYl8wXt5QeTX3opTow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767796270; c=relaxed/simple; bh=D8AxSemiKWwzplSHLSboj4TJDF/1ewd39FU62I//Zww=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TjWnni0bJQ2rmfjo9SMYS0ypf2/eCIydmx4uuZoZ/AdLP1cVfNqFD+gijA3uFsysjgZ/RBMmlVuEKINtA5vyyUJY9773BPihWfU6rT0HQhsjGpwOBJI9QeCxe1gEyq/3bxfNJRbDxbZNJvEskEmfeb4NK9M8kRFH2BpiUybN5Qk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pMZyLATV; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pMZyLATV" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-47775fb6c56so19356885e9.1 for ; Wed, 07 Jan 2026 06:31:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767796267; x=1768401067; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=0Zk7xXnEuh19gRn4MSw/h56LQt8KgVnQ0vjZH6L/AeM=; b=pMZyLATV1mp70dMhs1wM8FyvwF63r3NqBDbtkvjdk+ycguHwfgy4RbBwe+Pp6DNDiz 3AI/wagMF20aGFyEYo2DuE/WhSdCofPlPhDHXVkd/1D805OahOt/eppWNYP6tIDvx7Fy ldOx8WpC80/1rT+qn7V8M25Thdl9+3BRQgPITvdixG9/ApX72DZXJH4oe0YNPsFd3dFn qnVMK7g8I6CRw+bmDJp+JWfkSMq30YWtIZtLHmgOahzRduYhgaksKOVEKggMRn7nIL2r ELt7pxTAgIpvzuuxxI7FXi4JC3jlAsw44vJSNHV8/dZsTdBCRvSxFsQwLU3gZl24h02g cPXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767796267; x=1768401067; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0Zk7xXnEuh19gRn4MSw/h56LQt8KgVnQ0vjZH6L/AeM=; b=S5k9dPy2KCNRuHwKE0cDcQ2j3mxvnfvYF4hPeGb8GLFpFfbJHrP1SUUIl5WUC+5rbm kQsvCYxFb0qLvFn8mw1fBZZiHYexubDhvrcRdXxfX2goFMTa+9SG1/wxeJQqdaEIXDNR 7xX3aS0KVLZQioKoxM5RgDxjyw1bUYmLnPL3vhEKAGp9QIXoJYju0BcpX2jMHYnrA6+0 TkYCkknoOmyc83RChlDocrp1mmnbpKi+cJLjFhK2h/bvjEAeFcM+ysxnE0z4P6LbSOCv 1Bol1rteKnNHmVkIMi2UOf0e16w7z6RG+ttdJhY923QdDASkToMyYVVDtalzNs9Mb69C dNIA== X-Forwarded-Encrypted: i=1; AJvYcCV0dVR924EBPDYaURFR+yvvjKaBmWLreX5Qo+HnhQ7n/GKphPEbwCVZgIKL77C9lAwg9h19nCZbZVnaG3c=@vger.kernel.org X-Gm-Message-State: AOJu0YzHzy0j/YPYoILlo84hO7qii+P7fTA9h3W3ievMoYu47uankaL9 QnowdRvOM22bI1ZtPLwik79CELP0ZPJaOo6pO9s9xccQgQQi0SXqzmXqKrFdNX4Fcoc= X-Gm-Gg: AY/fxX5Q2UxEjFJuplyNw0hQ4Yssfqi8u+p3j+fL9UqEC9ZyAlfNTNp55ISr3m+uL6V 6HcVeiRui0tooe0bZARyrSSTgoNHdKpovIgzu3EBy+F87oRyvEiDLHBtnHGSb35ZE7CNo5tgaum QlzRKyu9Zsnzw+LV/htGZbHvktqAJGxnamzBNkeqcJ4BF21X0oE8PuJ1ITs0ZOcpDdMyDgfGkBT gw1gYlxts4xSs4t3eyIEOiGN80K2YBYcqyyyynq3sci8HhVDEKKCroHKPVg6iRT4cN1ruEQpUW9 +6tKlStByZ9km/CP9r9VYjHlm/96IKd7WxZMoRwGkfSrasUWnX7HqzLAoK6q04EG++4DidMKco+ Ir11KDHpimlSxfurIQou8gMtnh0TppRj89xOruIgxtVvCqnmT8Ua3hnMfnLsZu6IGMUZYcR5DKf JcU7CpTJsZGn8Jgnae X-Google-Smtp-Source: AGHT+IGKFvF9bPd/K7p2LRS+DkckL1HEjJZEVJ9c56W23qxdplsmQlw5GknvyXFPwiNFQLGI8KElVg== X-Received: by 2002:a05:6000:1acb:b0:430:f879:a0fc with SMTP id ffacd0b85a97d-432c3790b06mr3439013f8f.21.1767796267143; Wed, 07 Jan 2026 06:31:07 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5df8besm10132548f8f.26.2026.01.07.06.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jan 2026 06:31:06 -0800 (PST) Date: Wed, 7 Jan 2026 17:31:03 +0300 From: Dan Carpenter To: Karthikey D Kadati Cc: Hans de Goede , Mauro Carvalho Chehab , Sakari Ailus , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 RESEND v2 2/3] media: atomisp: consolidate statistics buffer allocation Message-ID: References: <81e2d12c-342b-4b88-88a0-3e24115541aa@kernel.org> <20260107134844.68074-1-karthikey3608@gmail.com> <20260107134844.68074-3-karthikey3608@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260107134844.68074-3-karthikey3608@gmail.com> On Wed, Jan 07, 2026 at 07:18:43PM +0530, Karthikey D Kadati wrote: > Refactor atomisp_alloc_css_stat_bufs() to use a new helper function > > atomisp_alloc_stat_bufs_list(). > > This reduces code duplication for allocating 3A, DIS, and metadata > > buffers and centralizes the allocation loop logic. > > The helper returns -ENOMEM on failure, triggering the existing > > cleanup path in the caller which correctly frees any partially > > allocated lists. > > Signed-off-by: Karthikey D Kadati > --- > .../staging/media/atomisp/pci/atomisp_ioctl.c | 123 ++++++++++++------ > 1 file changed, 81 insertions(+), 42 deletions(-) > > diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c > index 5c0a1d92b..9e572b3e6 100644 > --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c > +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c > @@ -678,13 +678,78 @@ static int atomisp_g_fmt_cap(struct file *file, void *fh, > return atomisp_try_fmt_cap(file, fh, f); > } > > +static int atomisp_alloc_stat_bufs_list(struct atomisp_sub_device *asd, > + u16 stream_id, > + struct list_head *buf_list, > + int count, > + enum ia_css_buffer_type type) > +{ > + struct atomisp_s3a_buf *s3a_buf; > + struct atomisp_dis_buf *dis_buf; > + struct atomisp_metadata_buf *md_buf; > + > + while (count--) { > + switch (type) { > + case IA_CSS_BUFFER_TYPE_3A_STATISTICS: > + s3a_buf = kzalloc(sizeof(*s3a_buf), GFP_KERNEL); > + if (!s3a_buf) > + return -ENOMEM; > + > + if (atomisp_css_allocate_stat_buffers(asd, > + stream_id, > + s3a_buf, > + NULL, > + NULL)) { > + kfree(s3a_buf); > + return -ENOMEM; > + } The caller doesn't propogate the error code either so this doesn't affect runtime, but generally we should propogate error codes. ret = atomisp_css_allocate_stat_buffers(); if (ret) { kfree(s3a_buf); return ret; } Same later as well... regards, dan carpenter