Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1957236pxa; Thu, 6 Aug 2020 22:16:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/OqxEVy3a65QKZinx4kjmXpHbMehGxvG7GB4SEV5QMm2dMD+4r07XkY6NMFNlsu4gGTqZ X-Received: by 2002:a05:6402:2037:: with SMTP id ay23mr7149190edb.48.1596777414277; Thu, 06 Aug 2020 22:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596777414; cv=none; d=google.com; s=arc-20160816; b=HkFoAmddprmMOmxjB8TptCW5HDXBCYQoCQ9aMZJLixS3dIXe0PNrzxnnIgvxf0F4vW 7ru53kh+HTb0MlRqCmCrKNPYsAhUekYXq/Zwcp6GfnPrnbjKr9rZsOWQ8GX8QRTQajzk yAVQUMeaGlSBCKJOwsZNVLy5g54DptWdFWsUsKMnxjXImqE4WHnmx6bbqI9yPmNmQqAB YePQN+4qVDLWLX/avwcXazo68vZDlw72eEUOEm0kf8pp0e8KfugEVNkknlBltDSNzfoY 0WG8b7ZSRt8d3yV4/lK6CwyioYhgHk0AGMyi+FRsRndmtqDA4DfBEwgkd6QaOK4N/qQR M2Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MBiQY6LTeMAyrNDctZTGpI85Qrwm/lT3KljbOVSIsIU=; b=TiK0PUYUF7KrcJ91dncEBqcFpt9ARUhvwEnJ5FVm4qIvQx6MnVP5wAXjgkyJTXEHjM 3GeOdz+0ncff969lPbk7xNw8Iaw4bi5afBnmjgRDIC5fQeFeOVLfYFO6JEeDKWwa4UZm m0C4QhJT5y7CG/IdN5ZmDSX7ShU6Jp/Y9lslH6+AsX0JkHu8OxyJkFf2DAMlBl1yGk72 e3sZ0wcTIDie3BEEF5Tjn+bSdlOAKS9wQ2EVZRf5WmUHB4Lx64LKsVhC1YMIYPHCUqha SukGP9Nv769oKmOFjNdRQRaa5kJbDGRqbFjiOO5Rwpj7hokDjao7ihW9Md4hs/4LGsOX Z4dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ci362HhG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ec15si4714931ejb.236.2020.08.06.22.16.30; Thu, 06 Aug 2020 22:16:54 -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=@linaro.org header.s=google header.b=Ci362HhG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726045AbgHGFPq (ORCPT + 99 others); Fri, 7 Aug 2020 01:15:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725379AbgHGFPp (ORCPT ); Fri, 7 Aug 2020 01:15:45 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72975C061574 for ; Thu, 6 Aug 2020 22:15:45 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id g19so526315plq.0 for ; Thu, 06 Aug 2020 22:15:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MBiQY6LTeMAyrNDctZTGpI85Qrwm/lT3KljbOVSIsIU=; b=Ci362HhGecTknDyD27bYk4NYh2QVzDcBfO5JQOtXkzSJOH1PsDnNYNdS10gyCsxzW3 O2vhmsHj9bEZmccLTmftVbo7hou0KQZbD5F62V9aze/T99c8Pz4rIDbZ16gco/NaNnV9 2gFnxGn+VlYt1WQmNrIPkPzzlcdP81j+I9ccqNRBi1qWCgs6KlaaB7Kn70nb8v3hBOkR emD26LjP48leji/aZd60gL0SZ8jY6Ghxx4HSXefXQncpDmKEFhFfIAgms+hYWTcbApsq ARWz9fGTdBnBQS1ZgxG+WVvNwmKKKbKe0RTTFkztJjTGQTZ1be62Mn8S9/NJWpZkW2Mp scvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=MBiQY6LTeMAyrNDctZTGpI85Qrwm/lT3KljbOVSIsIU=; b=HhgGVFaOIJJeRWR3np92CFaTsTBB9IVPj8KqJwake1RtIwsyr5LoOBd93BkSCLwext sluRqnEwKARwCYPIUBRqZ0mzO5GDVrJXmfXnKklMpbHjs6Rc7dlY/ME/Lovjqnzsn5Xj 2KhowJTRfR3HMM5oyk4Nay2L8nejN6cuAO7tiqmme0+QPMurP3Hf6XOHMe2Q7fSEk6rT BEX5ogRtskNQmwSVm3w1AaodxagCryEfrPMSq1QaWkLD7015LPHL8XbfbGqozGZKsfyw HNVwwbQ0embRy++KW0FLd+uj9d6U3GEut5X/phDumQ1YeCxcAKeilxHGPwLHIhNyOjU6 JzMw== X-Gm-Message-State: AOAM531JQCphkGU2mc45Ymdy2lLg0n3Ke01yzCWHvJCBBHXWCCYN1wY1 JqxgpRLmxoEbN3aWwF2Vg/Vv X-Received: by 2002:a17:902:b20d:: with SMTP id t13mr11008275plr.312.1596777344811; Thu, 06 Aug 2020 22:15:44 -0700 (PDT) Received: from Mani-XPS-13-9360 ([2409:4072:6d15:d4c4:a84b:5551:d33e:ccd2]) by smtp.gmail.com with ESMTPSA id s61sm9630018pjb.57.2020.08.06.22.15.41 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Aug 2020 22:15:44 -0700 (PDT) Date: Fri, 7 Aug 2020 10:45:38 +0530 From: Manivannan Sadhasivam To: Bhaumik Bhatt Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 10/11] bus: mhi: core: Introduce APIs to allocate and free the MHI controller Message-ID: <20200807051538.GC3230@Mani-XPS-13-9360> References: <1595901740-27379-1-git-send-email-bbhatt@codeaurora.org> <1595901740-27379-11-git-send-email-bbhatt@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1595901740-27379-11-git-send-email-bbhatt@codeaurora.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 27, 2020 at 07:02:19PM -0700, Bhaumik Bhatt wrote: > Client devices should use the APIs provided to allocate and free > the MHI controller structure. This will help ensure that the > structure is zero-initialized and there are no false positives > with respect to reading any values such as the serial number or > the OEM PK hash. > > Signed-off-by: Bhaumik Bhatt Can you please also add the Suggested-by tag? Reviewed-by: Manivannan Sadhasivam Thanks, Mani > --- > drivers/bus/mhi/core/init.c | 16 ++++++++++++++++ > include/linux/mhi.h | 12 ++++++++++++ > 2 files changed, 28 insertions(+) > > diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c > index d2c0f6e..972dbf0 100644 > --- a/drivers/bus/mhi/core/init.c > +++ b/drivers/bus/mhi/core/init.c > @@ -959,6 +959,22 @@ void mhi_unregister_controller(struct mhi_controller *mhi_cntrl) > } > EXPORT_SYMBOL_GPL(mhi_unregister_controller); > > +struct mhi_controller *mhi_alloc_controller(void) > +{ > + struct mhi_controller *mhi_cntrl; > + > + mhi_cntrl = kzalloc(sizeof(*mhi_cntrl), GFP_KERNEL); > + > + return mhi_cntrl; > +} > +EXPORT_SYMBOL_GPL(mhi_alloc_controller); > + > +void mhi_free_controller(struct mhi_controller *mhi_cntrl) > +{ > + kfree(mhi_cntrl); > +} > +EXPORT_SYMBOL_GPL(mhi_free_controller); > + > int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl) > { > struct device *dev = &mhi_cntrl->mhi_dev->dev; > diff --git a/include/linux/mhi.h b/include/linux/mhi.h > index d15e9ce..a35d876 100644 > --- a/include/linux/mhi.h > +++ b/include/linux/mhi.h > @@ -530,6 +530,18 @@ struct mhi_driver { > #define to_mhi_device(dev) container_of(dev, struct mhi_device, dev) > > /** > + * mhi_alloc_controller - Allocate the MHI Controller structure > + * Allocate the mhi_controller structure using zero initialized memory > + */ > +struct mhi_controller *mhi_alloc_controller(void); > + > +/** > + * mhi_free_controller - Free the MHI Controller structure > + * Free the mhi_controller structure which was previously allocated > + */ > +void mhi_free_controller(struct mhi_controller *mhi_cntrl); > + > +/** > * mhi_register_controller - Register MHI controller > * @mhi_cntrl: MHI controller to register > * @config: Configuration to use for the controller > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >