Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp344837pxb; Mon, 13 Sep 2021 21:26:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznklzhaVPWgXMtgkxsTFmISVB2zcHOKfsU4HYSvAsbl+2fNG1DWO5eda/E+NDr+yizH2jK X-Received: by 2002:a05:6e02:961:: with SMTP id q1mr10878362ilt.307.1631593561953; Mon, 13 Sep 2021 21:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631593561; cv=none; d=google.com; s=arc-20160816; b=yGf6vE4Z+8hSCMz+lcJNhagiktDhbABe5u6X6N9vqsK3QC8bGqhwFgYip9uhVB7/Sm EL0Wg4vzIYm3hOuRrtx2/AdIPCL4pKdDsBVZks9HQy0t7JM4W/aEV8+QApscu+Wl2e3R hGlOHRDEP5PsjS4M5tD7Jz9saJPSKA58fdAN2reyPFXWpIXeYVpMpgtW7nbe3I6TNe1u xPkFQt06s5wH8nuQj0OtsjW5KyD219tNGbvYrnsWoKfkrEF11dmNjN/NrmfYBoiT7JOU NlHclFrmu+XSI3xrlrtMe/r6Ferd/SeCMEametL0QkAtqu/iWHVI8F0rfOHCc9/TevYd Sfhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:user-agent:in-reply-to :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5H2bcMfxByKm2EVUg1iJMD5chj5K7B0S9zZLnk9vCwM=; b=tU9KY7Rw1KBwCEAOBN+7NisKJW96vBeaIeKwC5PvpcUO6ynWt3blyGdYLjWeJz7JQn kmtiGNZVlimN2js28oPP6jkqP5R6uyd1MAafUNjZ7MkeUPyb4gip+zOpoKY7VIo2fmvH C/uscGqFz3Tiu+CkZrVJ18+ySSSIPnvauDCQSJkQFCjFRkG5wY+p0rgVKg167Fm6rHtd xG0Z+2i3raEmQaGvwmP+AtHmYQKHzB48xHRZ9qzbCsUt/MHz2rM9isNBkyXh+1sPU9y0 u8Zk2HQc/8l4WIHnQIV5KVll1r6nPT9HbUZHj0laB4AWMtuK7mLgnzLxKfB29SElO0+b vuKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pathpartnertech.com header.s=google header.b="FID+wq/F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j11si7793460ile.34.2021.09.13.21.25.50; Mon, 13 Sep 2021 21:26:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pathpartnertech.com header.s=google header.b="FID+wq/F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232322AbhINE0Y (ORCPT + 99 others); Tue, 14 Sep 2021 00:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232354AbhINE0T (ORCPT ); Tue, 14 Sep 2021 00:26:19 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F3F2C061760 for ; Mon, 13 Sep 2021 21:25:03 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id y17so10930295pfl.13 for ; Mon, 13 Sep 2021 21:25:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pathpartnertech.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :in-reply-to:user-agent:content-disposition; bh=5H2bcMfxByKm2EVUg1iJMD5chj5K7B0S9zZLnk9vCwM=; b=FID+wq/FYlPSh2Z7HxqDdnou1mMCkl3k4Skk0P+X88RAl/VcGXiAkriocgpWuvPcXG Kq3x15rxwghXkeMt1PwPxs2PPwN4E0psiiCaEVxtG6OtHLt8RQ92CqEsCPCyUMGeQ/NY pXftPl9TKE+evQ16m0LGZWDNAfja9y63J5ojp537+OX+ZDqAZFAZu/iPzxeHMJkhjAE2 lFkQaD9GgI6GLq6zLc5jTUFF5IB51gATkDgjNTPGbHa4Xz93EKHJnslXlZ/ygM5RYDHL EtALtr6T+Xr1/2ClFzFLIOGukp024UM3n/umm294jlEpwxy/lycqYXX5/qqoCXdPTMbE Q6zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:in-reply-to:user-agent:content-disposition; bh=5H2bcMfxByKm2EVUg1iJMD5chj5K7B0S9zZLnk9vCwM=; b=N3SOcbXtrezCFqdVCoSNd3fP9n4AvxLKJob3p+e2ymmHgQXM8djgZOXinF7FCxrEFd 25NXc6zH9YZlirlHGyRqduJqtglaqiu2HFijmUJL/7eFXc09n4+8mbeklGo2nYFSH06I pDuYCXZnsSkD68Xpv8dkXmyPKrjyZgO2xnRIHFg1pYda4CLr3AlY1pTgM4yXKc7x9tfr 32HqXKJE5evCdK+Qjgjo2AbmqdpV65uMBu4V8WBgRuLLIhK95QyUUUvTguEWBxTugJLs ZgDWixH6lY+zRSMQAbAYe2uojebCAR5HgBo1i8/GZmCaCJm1el9+uE4pVW3kc9m11Ty9 54iA== X-Gm-Message-State: AOAM530coU9zucw11lFFBunswGtord289+O+WdMpFihHEIhO8iVgM33R f+fPL2Fw2lIc7D7eVdbrrnCt8+zINDQcoMDDlzsEQ7VRB/GjlMlFqMetEs8IWBgkF/xPBURwLVB muWN9Hefzxs4o+hnyTA== X-Received: by 2002:a63:ef57:: with SMTP id c23mr13797054pgk.60.1631593502582; Mon, 13 Sep 2021 21:25:02 -0700 (PDT) Received: from sidraya-laptopU ([203.201.61.238]) by smtp.gmail.com with ESMTPSA id d3sm9797780pga.7.2021.09.13.21.24.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Sep 2021 21:25:02 -0700 (PDT) Date: Tue, 14 Sep 2021 09:54:55 +0530 From: Sidraya Jayagond To: Dan Carpenter Cc: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, prashanth.ka@pathpartnertech.com, praneeth@ti.com, mchehab@kernel.org, linux-media@vger.kernel.org, praveen.ap@pathpartnertech.com Subject: Re: [PATCH 09/30] v4l: vxd-dec: Add idgen api modules Message-ID: <20210914042453.ttbf2atkzymqt5yl@sidraya-laptopU> References: <20210818141037.19990-1-sidraya.bj@pathpartnertech.com> <20210818141037.19990-10-sidraya.bj@pathpartnertech.com> <20210824140005.GQ1931@kadam> MIME-Version: 1.0 In-Reply-To: <20210824140005.GQ1931@kadam> User-Agent: NeoMutt/20171215 Content-Type: text/plain; charset="US-ASCII" Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 24, 2021 at 05:00:06PM +0300, Dan Carpenter wrote: > Of course this is all staging code and we normally don't review staging > code too hard when it's first sent because we understand that staging > code needs a lot of work before it's acceptable. > > One of the rules of staging is that you can't touch code outside of > staging. > > But since I happened to glance at a some of this code then here are > some tiny comments: > > On Wed, Aug 18, 2021 at 07:40:16PM +0530, sidraya.bj@pathpartnertech.com wrote: > > +/* > > + * Structure contains the ID context. > > + */ > > +struct idgen_hdblk { > > + void **link; /* to be part of single linked list */ > > + /* Array of handles in this block. */ > > + void *ahhandles[1]; > > Don't use 1 element flex arrays. Do it like this: > > void *ahhandles[]; > > You will have to adjust all you math. But you should be using the > "struct_size(hdblk, ahhandles, nr)" macro anyway to prevent integer > overflows. > > > +int idgen_createcontext(unsigned int maxid, unsigned int blksize, > > + int incid, void **idgenhandle) > > +{ > > + struct idgen_context *idcontext; > > + > > + /* Create context structure */ > > + idcontext = kzalloc(sizeof(*idcontext), GFP_KERNEL); > > + if (!idcontext) > > + return IMG_ERROR_OUT_OF_MEMORY; > > We need to get rid of all these weird error codes? You can add that > to the TODO file. > > > +int idgen_destroycontext(void *idgenhandle) > > +{ > > + struct idgen_context *idcontext = (struct idgen_context *)idgenhandle; > > + struct idgen_hdblk *hdblk; > > + > > + if (!idcontext) > > + return IMG_ERROR_INVALID_PARAMETERS; > > + > > + /* If incrementing Ids, free the List of Incrementing Ids */ > > + if (idcontext->incids) { > > + struct idgen_id *id; > > + unsigned int i = 0; > > + > > + for (i = 0; i < idcontext->blksize; i++) { > > + id = lst_removehead(&idcontext->incidlist[i]); > > You're not allowed to invent your own list API. :P Generally there just > seems like too much extra helper functions and wrappers. Removing this > kind of stuff is standard for staging drivers so that's normall. Add it > to the TODO. > > regards, > dan carpenter > I will make change for void *ahhandles[1] with void *ahhandles[];, will use "struct_size" while allocating memory. I will replaced all Error macros with directly linux Error macros. About customized data structure API e.g-list,queue, I am currently working on replacing them with Linux kernel generic dtata structure API's. Thank you for reviewing. -- This message contains confidential information and is intended only for the individual(s) named. If you are not the intended recipient, you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this mail and attached file/s is strictly prohibited. Please notify the sender immediately and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.