Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2268484pxp; Mon, 21 Mar 2022 15:25:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE4FcQWrtnRTdJ/0UQympbpWuil1ZoLXeBoZ5JdRTHRRRobTxC36zOH3AU/YTH6VyaWsB8 X-Received: by 2002:a17:902:edd5:b0:153:abee:1093 with SMTP id q21-20020a170902edd500b00153abee1093mr15357587plk.77.1647901549809; Mon, 21 Mar 2022 15:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647901549; cv=none; d=google.com; s=arc-20160816; b=s7nyI3MXspsVtE1uiecTEWw82gOMwHQnzx5CnSbFfroo5zieUyf+dzhVSXvYmMEolx s/QflrfoDFDVVbxclIONpZMoRYLPy/Hva5Zl+r9RdM2SeY7ZpJXLtSMtxF76IecvjxgZ nzvLiYdaEhactA+A/Kbad0fplJimep0+/c2x9vZZzXYuT11vWlGXJ4sk+w57e4hrnlSO NZbHe4x1gBAYGxlzkkwWxnKHOyvCYUPj+bTbfm/ZOfL2WwsUBSthrR2AXZI5pJGm8ZZQ 7Wm4U8SgPEV+2rpihSxvC5fQXpTCYaoE1+pPRJ9f9R0dYo7bC3g2lWeX1VHexTPrpjKI /NJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bqj1LsrbRdsU2hZ3+5yDck5mA3DG4AP9uGZA8BOzOz8=; b=FSwfHrGHWsKMup31WTcQ7sE5Qv6t3rRfpSPhEvDtTz0jhrRxFqqQEQfiZ96xBU/B+J U013OkP/omMaDq1HRNu+J6BMc/a9b4bHC7upekfyhJNZsmvCoOuNpvlsh2qG3WPyKquc dmdTUiI5o0S5D+PE2NVXHJ9sM3PCOuOFK8/malg+ma/8XLFJqUrNYiTEzcxHzy3HC4fM lKQbmvm8KrMMx8Aq+ySnFjNweBlLkDNNkbSLI9FB7xsl7zP/IKnrgKfs5QPZRk7sNvrB a3pl0vIsWmTE0FthPOFeAP1gLgQ/im0widtHR8pCn+1Zq0J06+2inL6ISH4BTby5lA14 74Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tdr9XGqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e21-20020a170902d39500b00153fae68065si11399788pld.538.2022.03.21.15.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:25:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tdr9XGqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66DE8483A2; Mon, 21 Mar 2022 14:40:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348504AbiCUN55 (ORCPT + 99 others); Mon, 21 Mar 2022 09:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348404AbiCUN4p (ORCPT ); Mon, 21 Mar 2022 09:56:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94CEE1728A0; Mon, 21 Mar 2022 06:55:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 48EED611F4; Mon, 21 Mar 2022 13:55:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C70DC340E8; Mon, 21 Mar 2022 13:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647870901; bh=nJtRHfaLe5NTL07RaKpu2Xj7ndP+2DVwsE9w+qaCDaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tdr9XGqmt/xit/lJIkGy3b+lRHSF5ig/kgWXsJTnvVqDOuNJelrsLxWY6WjLvHHa2 0MG+uy+xAGW9uMgIbYG4Q4pJkKV6GdKWhdCn0aPoEZxc/cunzv2/UVcb5roow/qv1d 0Uku1Kc5dp6Xbxup6Cz8Yv7iEIVTcXwy6sQ2gjoY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , Lad Prabhakar , Ulrich Hecht , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 4.19 11/57] can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready Date: Mon, 21 Mar 2022 14:51:52 +0100 Message-Id: <20220321133222.313434020@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133221.984120927@linuxfoundation.org> References: <20220321133221.984120927@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lad Prabhakar [ Upstream commit c5048a7b2c23ab589f3476a783bd586b663eda5b ] Register the CAN device only when all the necessary initialization is completed. This patch makes sure all the data structures and locks are initialized before registering the CAN device. Link: https://lore.kernel.org/all/20220221225935.12300-1-prabhakar.mahadev-lad.rj@bp.renesas.com Reported-by: Pavel Machek Signed-off-by: Lad Prabhakar Reviewed-by: Pavel Machek Reviewed-by: Ulrich Hecht Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/rcar/rcar_canfd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index 786d852a70d5..a1634834b640 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -1602,15 +1602,15 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, netif_napi_add(ndev, &priv->napi, rcar_canfd_rx_poll, RCANFD_NAPI_WEIGHT); + spin_lock_init(&priv->tx_lock); + devm_can_led_init(ndev); + gpriv->ch[priv->channel] = priv; err = register_candev(ndev); if (err) { dev_err(&pdev->dev, "register_candev() failed, error %d\n", err); goto fail_candev; } - spin_lock_init(&priv->tx_lock); - devm_can_led_init(ndev); - gpriv->ch[priv->channel] = priv; dev_info(&pdev->dev, "device registered (channel %u)\n", priv->channel); return 0; -- 2.34.1