Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1441317pxp; Thu, 17 Mar 2022 09:17:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5NjLFias6lzAivnZbuFrcEX40jsSPIaNdGOrxeC76bpUkjF8MREd/u9o9f5JPsjs7kycj X-Received: by 2002:aa7:80cf:0:b0:4fa:3983:87cc with SMTP id a15-20020aa780cf000000b004fa398387ccmr4750380pfn.85.1647533847901; Thu, 17 Mar 2022 09:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647533847; cv=none; d=google.com; s=arc-20160816; b=J8Xno2BoGWBK3Zb2crbeWx0niwGh490+iN+dzqhW3Ph4CG1IFQFTDdzyT1VDCvexge TGs4HHltTunu67MmBEPDf8/6fM7bXp2NDBp1zPmCXMy01I3dtstwnyE0XRhPtOYPWNjr G+3PMM9lqv8K9H1TfKksZ63qWf1BFEIC4+YMCoWG+RkGUsn3wMHRHkZW1uBMFoxOo7hT Pf4x7UuMyVBtVlzqy0t7Y7yzG830m0m57vdPrFZ7nYXmnEE43sKjkFkag+JdLFGL7/kd L8Mtrb5H3I41OX+NXF6GU81RPn4z4b8qJQpjjkWQ09Z+NvO1wr6KoU+KYcLZ7BN7ACcZ ES4w== 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=9bEkEkj/2MY8TPUp4kp/M3KXQeEnlSte8wqCeUjGrAk=; b=D1NYB6zUoQGk8eNHvNBafEv70riswDKLXHklY+9a3d4RQvGWuz616e3kdE7tMRK/y8 ktiH7pHhUw934NvTYCNVhA0CCD1ie0slRpYsF+BVXDTpSxraYyuN8HRFENjyOLeJNIpo WbMU5Xp3su2uPsCuy7CFvCW37ULdtAgiPV8kDgEXOXK6YCFYTJHdCZHaKQUVN6M+lBRj S704K7tqTw7KnuPeXILhyaTyVXNv/L7KFwp/UynQNt7xD1N29I12jcAsfIYAtE8GvG1h Sxi4xCJrgsYAHhF3YhXQ2MvBryeHf7UGMVB4MWVEcVd8IZjocD61gxJWS72wogxUB+yu qZSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sSOgYu8I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x18-20020a170902ec9200b00153ddaca9e6si3262198plg.220.2022.03.17.09.17.08; Thu, 17 Mar 2022 09:17:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sSOgYu8I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231959AbiCQMuc (ORCPT + 99 others); Thu, 17 Mar 2022 08:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233947AbiCQMtu (ORCPT ); Thu, 17 Mar 2022 08:49:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83B6C1F1D11; Thu, 17 Mar 2022 05:48:18 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4B46FB81E01; Thu, 17 Mar 2022 12:48:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76F83C36AE2; Thu, 17 Mar 2022 12:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647521296; bh=DS1Q7YDfa5cQlvAG52m1EPyp6K26+bOqkCOC/XXA3n4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSOgYu8IHgc5g+9u0fuDSTMdkPdplhxHFQds4bTb2KheUEHDNS1t/2WkIUlJVNeLr qVK21iYbCi2GHmcVMSD20OqcbTa8UxoG+nev3+IXSt0ir4+6RaaC5tLQI8SDQsalTh MH52tryq/YwTc48PI2gaLGQUkEzeG4X9L03CfMXc= 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.4 35/43] can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready Date: Thu, 17 Mar 2022 13:45:46 +0100 Message-Id: <20220317124528.643999787@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220317124527.672236844@linuxfoundation.org> References: <20220317124527.672236844@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=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 edaa1ca972c1..d4e9815ca26f 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -1598,15 +1598,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