Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1620856pxp; Thu, 17 Mar 2022 12:55:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2qjKLzMHpGxC3cYMFktdcdFmaxQG4wUQA9IM2ImbYMY3j7mjiXvMIlTnGmI0cw0rCyyZ1 X-Received: by 2002:a05:6a00:22c6:b0:4f7:5773:f402 with SMTP id f6-20020a056a0022c600b004f75773f402mr6750350pfj.80.1647546919586; Thu, 17 Mar 2022 12:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647546919; cv=none; d=google.com; s=arc-20160816; b=PvzxmtMclDmXhvSZj8lxiJmaxUFZFpWibLSz3012/2hCfUxmQuOx2qpp2YrTQIjWh3 bKsGPhJzBVJWRWUZDwBMluE2XAjx6TqD1rKPZiiHKcRsATXQ0J9BsOtjXzgEWp123ED7 Wy4kF5KNzDRPRNwDA5sSAE+KEEJqONPTDvl+dBoYQl0V13xzyobxOaB3sTttbZ8O/qJN 6olZe3lqX5r0JryA0pJqicq2qB24qknm8B0aZdkRpBNFRxP3cWkJAGBEZ9iubySxG0Qz emfTs3q2tdskMLDKJAf5r7RP+SRyNzoHb5yPAq13SUlCaUcCga49HtYtXGCchTiJm9zO hSow== 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=Ht5RbT2En/fsstb67pdM3WRTnQfoDqcnI4qLCSdw0vI=; b=fNHnQCT4CS2Sb5TmmIcrZNWwXExyWu/cw8yTgoIhIc/FBg3a3qc2GEd2SZVQLzWgoe aOW/hL255mu/i0M1UfVecvG4V3vzQh9qsTLM35nT3PusThkWvSAFZagdgVQY9VBszC3d PySPG0x5F/OqVT/2VUO55/TAwvo/oTDMndZ2fs2hMotyV0iwZFloRJ1QX4cVCv75UikV 15onCJhT5hA/HhFGmNO0Rk8SkwxdZIqRj3huZz9WobUgACRpsOBOpEtm7ffFna9ELyzO H7RlvgYkvj/D/iytAu8mWLqQ/ayOi/OPlIBdfGJuS2t9mngYuKqBOH43AlbOG2meITpg E0WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=US2BZAN8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x89-20020a17090a6c6200b001bf2784b66csi3395935pjj.93.2022.03.17.12.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 12:55:19 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=US2BZAN8; 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=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 AF6F5255178; Thu, 17 Mar 2022 12:49:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234633AbiCQM5z (ORCPT + 99 others); Thu, 17 Mar 2022 08:57:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234992AbiCQMyT (ORCPT ); Thu, 17 Mar 2022 08:54:19 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E3751EC6D; Thu, 17 Mar 2022 05:53: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 sin.source.kernel.org (Postfix) with ESMTPS id E8411CE2336; Thu, 17 Mar 2022 12:53:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF22EC340E9; Thu, 17 Mar 2022 12:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647521579; bh=5nw7cHt/RTx/pOOhvfo54s8PdS6J/svkQh4QT7q+nsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=US2BZAN8vnwgRJkm5XzPOF2+nF6G6J5r/JRz2bpWaqEq+4A3No8GkR1LUBNO1qZ1O excL/iDH1LfLMERMAzjbHX8licbd/xMWjqUSQBdUu0Mwd/Tu1Q0peofTcEoXUwmyAH Q7b+bCbqjZVkXbWjIdZuah+y0/jJPlK4hXFYByts= 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 5.16 16/28] can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready Date: Thu, 17 Mar 2022 13:46:07 +0100 Message-Id: <20220317124527.228586235@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220317124526.768423926@linuxfoundation.org> References: <20220317124526.768423926@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.5 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 137eea4c7bad..4871428859fd 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -1716,15 +1716,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