X-Received: by 2002:a17:90a:3b04:b0:1bc:72f8:c8a with SMTP id d4-20020a17090a3b0400b001bc72f80c8amr1289746pjc.176.1645507420664; Mon, 21 Feb 2022 21:23:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645507420; cv=none; d=google.com; s=arc-20160816; b=uUUAeaNC0glDqXqkyLfyW6/UpQhFUBVa3B/k6rATc87MLe/9xmb+aezNtD/f7KOHLS 9BCiAp7964q2DuENxhyNVTex3OpQqi4sI/wxJwP6j1r9MEbR2mbwFgbFZDeeqpJsI502 7jOyKuHx13muQrUyNtY28MgrVSGikH8hgLnKzM2aV9clYR6fzhuH7DY7W+lAc29cl5/+ u2y+ypMcBc0wXHVgPksm9MGN/BAx3Lo7pU/JAqmerHR5ExE+SGJdCmElPV2oxk31smht AEL1faU3NQcCGSMSGZ8XLIeQKOuO9qNpYFMdCAdO1oYjvfNnXZUpsFncXLJVoFULK2FT IPJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=V07Wr1RPwDzmT8J8s+b0HjxvCOJLaXk6DjACguy+w/w=; b=pRrsr2emWOPr1rzskmuDygbzR3Ps2srZJeD5DJz4B3Z7c7hnmvAif6mfuajLx5QR9q Q+OSTPZBNBQLZpKBFOY9GpljvLjjUzA1DtrbqKqdv68JpgeRn1XEGi4SRjmO5gOdst8X mnsiDQXOuYYt5H6w5aasK+Uh/44LURFFoG9hUUlbMKD2MusOFmcd0uiIiu6WbzQNTP0m 3a76ph0R9NMp0osGVc0QxOHVpp+jcGVM17WqyUPsEwCtOHL9WQjvqlAQkQGArm6wNV3q kh7QBWLjpLjRIGCA4SFUrjD15MDBefJZAjhv5le/LLRSIsXbkOfqnPZtYiB85NW0Woje l7kQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a3si37859719plh.615.2022.02.21.21.23.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:23:40 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 079ACFE40A; Mon, 21 Feb 2022 20:54:26 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235935AbiBUXAI (ORCPT + 99 others); Mon, 21 Feb 2022 18:00:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235524AbiBUXAH (ORCPT ); Mon, 21 Feb 2022 18:00:07 -0500 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65DA0E23; Mon, 21 Feb 2022 14:59:42 -0800 (PST) X-IronPort-AV: E=Sophos;i="5.88,386,1635174000"; d="scan'208";a="111954663" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 22 Feb 2022 07:59:41 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 292234008566; Tue, 22 Feb 2022 07:59:38 +0900 (JST) From: Lad Prabhakar To: Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , linux-can@vger.kernel.org, Pavel Machek Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Ulrich Hecht , Lad Prabhakar , Prabhakar , Biju Das Subject: [PATCH] can: rcar_canfd: Register the CAN device when fully ready Date: Mon, 21 Feb 2022 22:59:35 +0000 Message-Id: <20220221225935.12300-1-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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. Reported-by: Pavel Machek Signed-off-by: Lad Prabhakar --- 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 3ad3a6f6a1dd..8c378b20b2aa 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -1783,15 +1783,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.17.1