Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3950370pxj; Tue, 15 Jun 2021 12:05:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEWGcwnxTHcgvH9uvDEeS4TN8BTjXTS+l3tKUB1kwbANU7PfVIcAM6W8sSmfzrvB7e1Tmc X-Received: by 2002:a17:906:2bc6:: with SMTP id n6mr1185540ejg.256.1623783950791; Tue, 15 Jun 2021 12:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623783950; cv=none; d=google.com; s=arc-20160816; b=DV2k4oJ0kqh/PfF7OjoOG2chvj2OF8RPAWytTkrxDQAJH8YdsLSHv0z7LSTskcW+Ys 1JdwznANZ/HJNocWBDLwlqmtiGCJUAkAzEIuziHGO2MaGCkRWe9p6qIHOVjrx+3SZhNd BdI/BQk67hSsP9UZs+0L8Nq+xXfke4tVFKGcoLDY2RO3Q7it5wHKcKio2MALCl+cG6wH RZYPJtAl0ShZfE5LEW6YXRPKqN4ltP7de2LUY1ycQMoWSVu3o+YOg/hQThalkA0lodvW /NoeJsaEm78B6YJSY0bYkpoCnCyu2KevqkdAH2k+tzUbknznlIWp/FC2p54PlFyWQPVj GX/g== 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=s4MbUn0A7BsUXdZ1lWtEQK9g1U4XtYOuBoPX4WRDNVI=; b=015biKBxzCIKvyAhuxzSd13nO9zQWiTXkT5zevLkMxCAZ74OKtyEpyI6G6kGBNezdh hWgNNnSrbCi2HMCdRbVoYp5Y3AeQrU7C6qvDh8vHM8p/RHsmk/nBuAxVj7inNANtjEYg migJeKRAIpBl5qL5OKfuDRmm2humZ6vUoBcgZFmpOxGs6YtREV2AZOS2oXyBDSgMKX5c POQYkEuV57K+mdE1qHpOd7AELZQBvZ6bhLJBs2iXbmAaUw0K7eNzKJud2FAtDePpVHYd ob05L8khLKmVMptAgtYYqJTJfUHdfYjgl1MBlOYNIrQfR+HmrA4H6cXMBhGRkujRtNIw jN5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=Wr0R6Mtl; 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 c2si206879edn.223.2021.06.15.12.05.26; Tue, 15 Jun 2021 12:05:50 -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=Wr0R6Mtl; 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 S231451AbhFOTGP (ORCPT + 99 others); Tue, 15 Jun 2021 15:06:15 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:59815 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbhFOTGN (ORCPT ); Tue, 15 Jun 2021 15:06:13 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1623783848; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=s4MbUn0A7BsUXdZ1lWtEQK9g1U4XtYOuBoPX4WRDNVI=; b=Wr0R6MtlKBkswT+mfMferJ18/yFrM4xIVwHfUjMG2UdJHmQVyHRdckM9hoBqxwa8Q2YadIsD 0ftu1XRO8v59LsejyWyclHlDDVXKkqYpeqLLX2mifLAvnvRdfuMICR4UcYT8oIfwtP8t0eOF cUQVB0b6vYq8HMjxbtdK/a9sAjM= 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-n05.prod.us-west-2.postgun.com with SMTP id 60c8f99ce570c05619ff2e64 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 15 Jun 2021 19:03:56 GMT Sender: sidgup=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 15703C43217; Tue, 15 Jun 2021 19:03:55 +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 ECCB1C433F1; Tue, 15 Jun 2021 19:03:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org ECCB1C433F1 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 v4 2/4] remoteproc: core: Move validate before device add Date: Tue, 15 Jun 2021 12:03:42 -0700 Message-Id: <1623783824-13395-3-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1623783824-13395-1-git-send-email-sidgup@codeaurora.org> References: <1623783824-13395-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 Cc: stable@vger.kernel.org --- 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