Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3268651pxj; Mon, 14 Jun 2021 19:27:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMX3leVl0SdrUk0CK/So8quvCo3cFiuhztPtzAZYZeCeNdugLS9Fk1sSZIVvux3NlxVjHV X-Received: by 2002:a17:906:dffc:: with SMTP id lc28mr17672240ejc.96.1623724061588; Mon, 14 Jun 2021 19:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623724061; cv=none; d=google.com; s=arc-20160816; b=YtoQ0JHIS0qVTLNgBJuWpor/V+/9SJ4GIubAlz8mg6HEo/2ayaDTgtxOZHyKxw/aOx vTx4bm/VxETOWCQj3SufrDVRguRIP82U6BQR5KjCRpjhMgT3gWHuYlyZ7s+inTPtBKqZ PA/fFuzGy3Ez+0zsdZAYr9GxGb4aj5U1oiGn6kKBTJk2xK/BoCZ1MhZzlj5vMlexiCxv aM3LY0PQ0iDwAwe7i+kD3ZE+yCCgq4lOuPyjVPYhDq0PXflpGj2svRoyF/ozGmYIYbjz GUbAiNrxHKI+GL+FEGfwi4D1vHUz3vzAIc63mMIerk3KhbzylUC1M/XYX6ekAfugpLd6 4fWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=kVXQqBjg44exOyQ9zuMMJbd+4d1juBSf1Bx5/kyYgoY=; b=j7R5d9C0HdWYlJo9ifWQmyed13kz2uF2ckthq8Ut9OO2nlAohGQTFAa3459y5WsQDA /EFwK+GkawA60yFOqbMcxcP9FswoEVTa7ebvns37CZYkKa1F2MNx+yWNIg/Dxq4FiiIS BIfB09pGlRixba7hmrsMWJkxgnDxsM00NaGfID/rzh0PC3HOgEARu33qjAQNKjEeluOt ZPYKqRSfuVJfhrzntqE7XCevtt10q7gSXE1w9eBE0qhqJHnpxgtkjcDS5F3DzJyxN9GH 9LOEURfPAt18D8XypPvUi8EDxnBzC/cvqyBDxSZi2qucEkCEQIR38DagYaUFhSylWbSt GHuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=sh2jLsyd; 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 p25si13030123edx.114.2021.06.14.19.27.19; Mon, 14 Jun 2021 19:27:41 -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=@mg.codeaurora.org header.s=smtp header.b=sh2jLsyd; 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 S231843AbhFOC0d (ORCPT + 99 others); Mon, 14 Jun 2021 22:26:33 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:61087 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230478AbhFOC0Y (ORCPT ); Mon, 14 Jun 2021 22:26:24 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1623723861; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=kVXQqBjg44exOyQ9zuMMJbd+4d1juBSf1Bx5/kyYgoY=; b=sh2jLsydzB0xqTI+Vblz+B4RVpylOqLQMNfcKCgoa5mdluwk+WSFzfmm03ytLqc2E5NyhRFB PzYDDiS/DtkrgL7CEcKi7oiA1MZ/0Ic4T76Pr/GqUOBDYKUN6E2Zlqt9/T/Znee1INrIK11W V3FHyOpcSCf9v6351/LKb+62Gvg= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 60c80ea1ed59bf69ccec8314 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 15 Jun 2021 02:21:21 GMT Sender: sidgup=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 98D6BC433D3; Tue, 15 Jun 2021 02:21:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from sidgup-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sidgup) by smtp.codeaurora.org (Postfix) with ESMTPSA id 69ADFC4338A; Tue, 15 Jun 2021 02:21:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 69ADFC4338A Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=sidgup@codeaurora.org From: Siddharth Gupta To: bjorn.andersson@linaro.org, ohad@wizery.com, linux-remoteproc@vger.kernel.org Cc: Siddharth Gupta , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, psodagud@codeaurora.org, stable@vger.kernel.org Subject: [PATCH v3 2/4] remoteproc: core: Move validate before device add Date: Mon, 14 Jun 2021 19:21:09 -0700 Message-Id: <1623723671-5517-3-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1623723671-5517-1-git-send-email-sidgup@codeaurora.org> References: <1623723671-5517-1-git-send-email-sidgup@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We can validate whether the remoteproc is correctly setup before making the cdev_add and device_add calls. This saves us the trouble of cleaning up later on. Signed-off-by: Siddharth Gupta Reviewed-by: Bjorn Andersson --- drivers/remoteproc/remoteproc_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 9ad8c5f..b65fce3 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -2333,16 +2333,16 @@ int rproc_add(struct rproc *rproc) struct device *dev = &rproc->dev; int ret; - /* add char device for this remoteproc */ - ret = rproc_char_device_add(rproc); + ret = rproc_validate(rproc); if (ret < 0) return ret; - ret = device_add(dev); + /* add char device for this remoteproc */ + ret = rproc_char_device_add(rproc); if (ret < 0) return ret; - ret = rproc_validate(rproc); + ret = device_add(dev); if (ret < 0) return ret; -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project