From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3E0FC2D0EF for ; Fri, 17 Apr 2020 17:04:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D32220771 for ; Fri, 17 Apr 2020 17:04:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jpN1OCeI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cPLUpW8n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D32220771 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kAqcN7jdFWjMikgmc6DyBP4vEylxhB3P2am4r4tQd90=; b=jpN1OCeI9EjdM9 3AItdqSF4RqzM9yTiqdPX6m2Z7pzd8XAEPWGoK81P7/xK9UjcYXcl+mWwnNFOjmntM2V1cJOuv1bY psJlXPLNZ9s8Zii5Znght4rVZ6tfUXOyRzJzQpbpfVkEX++2PepSMYKHoRRVCgrSgBMwuSIB1bysd ZnWSs5hzpgUfBwnJb2eCm3ITow+Jiu7XUSSNyejX97mWTwlMAZYv2vvO2e2IhM25PkqJIVnXs3GeH 6KUmDrRH9ao4j1wREkhTIsKE/AufUnj/fD2Ka3hy1N/ZCDjK15kQJyjEQgQMpbM232RNR2tYTk7vZ 8l+Z4GqMJtgXPv7MOTDg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPUPq-0003k0-Mt; Fri, 17 Apr 2020 17:04:34 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPUPk-0003eP-TO for linux-arm-kernel@lists.infradead.org; Fri, 17 Apr 2020 17:04:30 +0000 Received: by mail-io1-xd41.google.com with SMTP id 19so3032737ioz.10 for ; Fri, 17 Apr 2020 10:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4lySji5eZr7vFRyXo+ccYCUZufUMHPBXSg6yDFBfT+0=; b=cPLUpW8n3CrcKqGSdBWo2qZR4aSmpF9ftFZ+jW/FhLcZDtbjVnLrWPHldUq6G4q18R uHnAt/ExkFHgTiWZyPw1571yLyTaII6dejTxO1K9JCbxeM4rqv4SazKR8NuHJLjOYdzh RBLshabzlDr9UEeKGsxqNJ+P0RRLpuiotqQqqGi8h7H7dvW8PaQj2VemkHAu3ax8G3kp L9iXqGPAwJ5s9wU4GsuRXfY/gnyEfkdQp5ipYFfRhsZhjpTRF1o3ygmDfSQ37Vffaw9h 2UCGbC0JZ+b0HoMmCC3/JnFdPYERkS63qAGXwqBwizdwz+W/+GaTp/M/QAJ7RHJuYv7G 9XdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4lySji5eZr7vFRyXo+ccYCUZufUMHPBXSg6yDFBfT+0=; b=VYij0xfEzhissCt6ltD3PuejFkHosYOJNPhq1YQZZEn/2bnXywIf84C9gd3fTV3zyz h4EUrfwY16iaWBaoQNlErYoC3GJWwBOikmf030bIl81MWRZeFldDvmCmT5g/0Zf8ePxv +4f6Q/3H/X6ErZZu4e/fyhx7KtVwSseYiGpwh2NFti5rlod3kNTf/JQ3cF+Vb6sPaXwu AkRVJa/tfHpddf3wOx3MsP9GeV7qJWAgEuGR4nKhuI6k+kJnU8uVFIp96GKDLD42udRg jpW/Vh3cnjNKVkhCk780q1Jiu6C4+K4IUTp+BtfnR+rrrFx+ku7P78xHET3ttasq44ph PScA== X-Gm-Message-State: AGi0PubZX6KewKe6NmlHFvr3m97UC2rpfn+2y57fj1IBx79GpdfylO1a OVPqzCcwI6goaNiwHF2AO2CeXm/LoPWIz6DmBsLtSw== X-Google-Smtp-Source: APiQypI9r6/CwVn7ZGYRSPvTc4tAXquIPq+CygktIDWtI503IFDTNxMoO6h/tMkgcO8GaCXcGtosrwZ0ZCzspSiKM5c= X-Received: by 2002:a02:4445:: with SMTP id o66mr4093213jaa.36.1587143065543; Fri, 17 Apr 2020 10:04:25 -0700 (PDT) MIME-Version: 1.0 References: <20200417002036.24359-1-s-anna@ti.com> <20200417002036.24359-3-s-anna@ti.com> In-Reply-To: <20200417002036.24359-3-s-anna@ti.com> From: Mathieu Poirier Date: Fri, 17 Apr 2020 11:04:14 -0600 Message-ID: Subject: Re: [PATCH 2/2] remoteproc: Use a local copy for the name field To: Suman Anna X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200417_100428_986525_37CF1067 X-CRM114-Status: GOOD ( 19.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-remoteproc , Linux Kernel Mailing List , linux-arm-kernel , Bjorn Andersson Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 16 Apr 2020 at 18:20, Suman Anna wrote: > > The current name field used in the remoteproc structure is simply > a pointer to a name field supplied during the rproc_alloc() call. > The pointer passed in by remoteproc drivers during registration is > typically a dev_name pointer, but it is possible that the pointer > will no longer remain valid if the devices themselves were created > at runtime like in the case of of_platform_populate(), and were > deleted upon any failures within the respective remoteproc driver > probe function. > > So, allocate and maintain a local copy for this name field to > keep it agnostic of the logic used in the remoteproc drivers. > > Signed-off-by: Suman Anna > --- > v1: > - Patch baselined on top of Mathieu's rproc_alloc() refactor > series, and so addresses Bjorn's simplified cleanup comments > - Switch to {kstrdup/kfree}_const variants > v0: https://patchwork.kernel.org/patch/11456385/ > > drivers/remoteproc/remoteproc_core.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index e38f627059ac..3cebface3f26 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -1984,6 +1984,7 @@ static void rproc_type_release(struct device *dev) > > kfree(rproc->firmware); > kfree(rproc->ops); > + kfree_const(rproc->name); > kfree(rproc); > } > > @@ -2069,7 +2070,6 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, > if (!rproc) > return NULL; > > - rproc->name = name; > rproc->priv = &rproc[1]; > rproc->auto_boot = true; > rproc->elf_class = ELFCLASS32; > @@ -2081,6 +2081,10 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, > rproc->dev.driver_data = rproc; > idr_init(&rproc->notifyids); > > + rproc->name = kstrdup_const(name, GFP_KERNEL); > + if (!rproc->name) > + goto put_device; > + Reviewed-by: Mathieu Poirier > if (rproc_alloc_firmware(rproc, name, firmware)) > goto put_device; > > -- > 2.26.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel