From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26AE1ECAAA1 for ; Tue, 30 Aug 2022 10:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbiH3Kxf (ORCPT ); Tue, 30 Aug 2022 06:53:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbiH3Kxd (ORCPT ); Tue, 30 Aug 2022 06:53:33 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AF4A61B3C; Tue, 30 Aug 2022 03:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1661856811; x=1693392811; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3JtcZwD8ykfZwltMBZg2Y5mHojyWHZBx52LH+LqU5qU=; b=i9Iq2HTPW9om5KJ41RLiywtBmNGflLfPq2Pmq2kHVgel4j/pJnuAtSKH 36P/BIaaReJwiP/BrbfqtBpCFChSjdeU0mpj+Nbo1oRG/lAYqU5LMtG7M kRMmxh3slbemT8IXaEgiZnfm68UF+YJRyOO6HISLHFOhx1jNWeW1mJ50B xC2SdJnn+Iw/ngalDuEqomqnd2uHDc8/XGEsEr2sa6uxlcNrhaosJbwQy ncyaK0OUZOm8sS81ZLN9W9FipbH//7KBGVFnH1s817jGXgSmpFzVTui4c L3bT/xOLp1ieYXWfbADrpOns7+zOTm9bSJ7p18tUcfPXNnS0uiCgQKIiW g==; X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="188626311" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 30 Aug 2022 03:53:30 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 30 Aug 2022 03:53:29 -0700 Received: from CHE-LT-I17769U.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 30 Aug 2022 03:53:24 -0700 From: Arun Ramadoss To: , CC: Woojung Huh , , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Russell King" , Tristram Ha Subject: [RFC Patch net-next v3 1/3] net: dsa: microchip: use dev_ops->reset instead of exit in ksz_switch_register Date: Tue, 30 Aug 2022 16:23:01 +0530 Message-ID: <20220830105303.22067-2-arun.ramadoss@microchip.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220830105303.22067-1-arun.ramadoss@microchip.com> References: <20220830105303.22067-1-arun.ramadoss@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ksz8_switch_exit, ksz9477_switch_exit and lan937x_switch_exit functions all call the reset function which is assigned to dev_ops->reset hooks. So instead of calling the dev_ops->exit in ksz_switch_register during the error condition of dsa_register_switch, dev_ops->reset is used now. The dev_ops->exit can be extended in lan937x for freeing up the irq during the ksz_spi_remove. If we add the irq remove in the exit function and it is called during the dsa_switch_register error condition, kernel panic happens since irq is setup only in setup operation. To avoid the kernel panic, dev_ops->reset is used instead of exit. Signed-off-by: Arun Ramadoss --- drivers/net/dsa/microchip/ksz_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 6bd69a7e6809..da9bdf753f7a 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -1963,7 +1963,7 @@ int ksz_switch_register(struct ksz_device *dev) ret = dsa_register_switch(dev->ds); if (ret) { - dev->dev_ops->exit(dev); + dev->dev_ops->reset(dev); return ret; } -- 2.36.1