Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3069710pxj; Mon, 14 Jun 2021 13:42:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytzAR5kaVW7/UMEADrXIEUVZ7HtFlWumrPNKzloUGtkPPKC2w3Xk//5E9pXtY1L3emf0So X-Received: by 2002:a17:906:17c4:: with SMTP id u4mr17362864eje.481.1623703377805; Mon, 14 Jun 2021 13:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623703377; cv=none; d=google.com; s=arc-20160816; b=Kp7oq3hG3kqZwe2LzC728HywQsgT0sPGb+l2xh/k2cpyD9hj01PO26HfguYqAlpviA +HCpRsgg8HJPhhLKzNvS7460/EzZNDrHIAJ0rrgHPnTtYA0oxKaNV60n2Ui5rYvrtsJ8 ult1sivQv40Y5qNnSgv2JBxDbg/8gExPmO/Bl9EEaRe5sIBP+sBHDla2Mb/OBAdHQEYg t1QRC+e58YtlZ6gZ3+F4GsgaPD4qNUzBMaadjToUMQ/rRmnQImndoAp8Yrd8CkWgGZe8 PZWptVOMiSmibSuQr0E3C109Xu2dHpUZYMCi04F4qn6C1sf5fTmCh++7dBgBJCXAUa3K mVbg== 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=nn4j5cvJ0k7iquYaBOiCQcLmmWGbWJ0XnK4onUUD8deyL+soASY8dbn6p3UkqGcHgE ClKm4uMnqF+yl2j6FVcqYA0Bt67D9xSPdSrUhca4sYok3kkccbCpViFMUItXO1ZnuYHa rEscdErAqCy9+QpNZM9RBaWMraAvqaewILDkETcjQ2udAJjHqErlpml/A8apcY6N8if/ Y++13PFPVamnyDmNQ80WL1YJpPW7xpKxNsM0gGSqNsi/ciaMDCAWtA8fiwgtQcTGKabR 3CXaqi8dpZ0wWvDYs/XZId/0MF977pxXWR88szlIRPtA6sqBYzcb1s/rCMrYv1jF2O6g hfMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="xWsL/BZo"; 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 r17si11582712edq.54.2021.06.14.13.42.35; Mon, 14 Jun 2021 13:42:57 -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="xWsL/BZo"; 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 S235652AbhFNUnL (ORCPT + 99 others); Mon, 14 Jun 2021 16:43:11 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:24019 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235586AbhFNUnG (ORCPT ); Mon, 14 Jun 2021 16:43:06 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1623703263; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=kVXQqBjg44exOyQ9zuMMJbd+4d1juBSf1Bx5/kyYgoY=; b=xWsL/BZoJ3rh3IO8v1lzEebUL144HVKm7dUdE9GFsMdX33knWmDwMbUE56DljVAeUeidwtMI qLEnSiQMwifHJtaRmwzo1gSVIx3dwhlqzDRvmRx6JFfj6nBKoa0oWG8n/zozLcSv6kMcGT/F +N3PqFFYz1xcPGGG7ugNtk+ZyAw= X-Mailgun-Sending-Ip: 198.61.254.9 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-n02.prod.us-east-1.postgun.com with SMTP id 60c7bed9e27c0cc77f4f1558 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 14 Jun 2021 20:40:57 GMT Sender: sidgup=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 92C37C43144; Mon, 14 Jun 2021 20:40:56 +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, URIBL_BLOCKED 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 BCC32C4360C; Mon, 14 Jun 2021 20:40:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BCC32C4360C 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 v2 2/4] remoteproc: core: Move validate before device add Date: Mon, 14 Jun 2021 13:40:42 -0700 Message-Id: <1623703244-26814-3-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1623703244-26814-1-git-send-email-sidgup@codeaurora.org> References: <1623703244-26814-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