From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8A24390C8E for ; Wed, 8 Jul 2026 23:34:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783553652; cv=none; b=ibOgxfX/Y3kPZgnzqcC6zcLO+9cTqqD4GICclhawCLYocOpHyo+4d8zL9S4b5Wt100SE6LWURVbVF+GK9OF9jPvVLyFBeKzxnkrsD//GGRxb0nJZaqS/TwJYbrjwnqs0tE6LvRhA+DY2zBXl7LxYwQwVJU6B3IgmZ7PsLtMO/Ro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783553652; c=relaxed/simple; bh=A0Dxdory9hMsY0U9BoiMisGXGz0kh03T5faevW7vQE4=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version: In-Reply-To:References; b=lgFsu1WKKpkTj0BLYzqsBgxdkC2CwTQWWmjhgQr0A3Qgu9MCFN21WIIfUMY3N2LLqNyjZ8FHI//NFPQcEWZSiCEEpH92hXonjXLr+Vab1QKM6oPrmG95waDcIAdJEaiolOmwy7fK4YfyHKFB+IhoDHmVKEb5Rx4/CGHMrtAEAuw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KQJNoQxB; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KQJNoQxB" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2cc7e86e7aeso13055985ad.2 for ; Wed, 08 Jul 2026 16:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783553650; x=1784158450; darn=vger.kernel.org; h=references:in-reply-to:mime-version:content-type:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tkrEjWV2T4kZn9l/EN1RfmTfNtrV7m8I3DpucB/PUhw=; b=KQJNoQxBrxfXJXO6sJR+8MwqE/GJhF/vYt35S1hbX4okELC/saJ/WDT1wkDRgKmbQq Ed2Uf47R+IOXMg84QluT7lcOOFfiQhaqAVPnHo6Ssg1rbN7BJhxjnVWpzSF41Tk3wzBx hwSNbDBewU+jrXAl75ZviEwlIwb6VNEV3SXnRaCbnYZTINkdijEIqOK114syqBaR/+Zn 8rkSdjWFzocfbymIbxk5hwDvF3lBmPSuzPZVlxotIruFMLgz3mPdqOoamKOO2HVayoSy olyEOLnIsqszXDH5AXBpD63JaKbaAVAfpJA2O9/d84JPNpeX99o+MbXLM7n5laMC1TYR g4VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783553650; x=1784158450; h=references:in-reply-to:mime-version:content-type:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=tkrEjWV2T4kZn9l/EN1RfmTfNtrV7m8I3DpucB/PUhw=; b=pl1yLwxfbi+Chos8S6ntDnB5J+pRC213O1RQDAJ37/Oh+FDbZSMl5ofmJDSWKdy6fC hvDUD7bS1TA+xabujpFExGD2c82hBaeVgazVsXTyFBeeCtTVDXIZUp50hrSMvl/rq4FU TzmT5NHZK/GJ6/iYvHLZ4SFTIJm6l8qlKnQyPJU6d8YZgDrG4nlp0ESnFr+5AkkN70MA FhuZTz5VQMAox+tEc+U7kTzGmEu9TLLxeWiqx+fI94ozYo003af/SvEJjMjynKyx2aBo OaoFnHh8rW1X5vB9VkaQ5kf1PAXbvccUxiME/vnNDmxJzGKFLDYl/xW5dEPSeNSUUgDA Vs8A== X-Forwarded-Encrypted: i=1; AHgh+RqrO/TvqSFSKEAhhcNcUzz7WYdpeCusID7iZpik0tsN3DGhv4mt8B628o8RRuCjk2SAaACxtOUV6rNV9vw=@vger.kernel.org X-Gm-Message-State: AOJu0YxYvJeliPtOR7Gks1RriKoS5yr1Avv+93UI80wb/0nIq3/FYDzU J8OTDPS0itSL5up1gGYeZiXU8DGK4DmcvxgJXcl2vJdm4jPpCVKwN9/g X-Gm-Gg: AfdE7cnt+7BdMtLkabtpGYLOVdbDowbiX1FB0BnuKyTGCwEGPjsqdvM1e9s95Aw6zow Elw1jQnQllwOJpTNvWDhaFzeqiU2GjU+ETEyJqMg7lr55zj9LRSBs9EUhnb+X5CCDbuenF+QhpT p3RmYAwDWzXNpYXCxZvEe9rTOONRv+RsWZqn18yJLceWX9bk493sWzAaL896vD6q/KgY7ntgtH8 r2WvrkiUj3dAAMjHAhexwE6FkmA2rj05SWYm26p3Of/cpGrXc+r8i7mPH0+x+bWLK5w7dpGfeuu sYDF5APxHD3ld7sNPGFlkN9uoXw004OJe2eN1qBunMBhbJzNq/B/OVRPO5UrVP6iveCNZdxSLHH yvB7EkDnwuGXzEP4AZEZUGx71KYEzBCCyhxBu17YNO4AiZaqWPt6mirZHpmFLD2XOd/3qYTn9Qo VM+l/dRw== X-Received: by 2002:a17:902:d58b:b0:2ca:cb8a:f26b with SMTP id d9443c01a7336-2ccea348afamr45697605ad.10.1783553650075; Wed, 08 Jul 2026 16:34:10 -0700 (PDT) Received: from [127.0.1.1] ([47.253.114.73]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ccc9bdb56fsm34840455ad.15.2026.07.08.16.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2026 16:34:09 -0700 (PDT) From: Wayen Yan To: netdev@vger.kernel.org Cc: lorenzo@kernel.org, horms@kernel.org, pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, andrew+netdev@lunn.ch, angelogioacchino.delregno@collabora.com, matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Daniel Golle , Qingfang Deng , SkyLake Huang , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 4/5] net: phy: mediatek: add calibration logic for AN7581 Date: Thu, 09 Jul 2026 00:30:00 +0800 Message-ID: <178355364330.113879.7307879640095189809@gmail.com> Content-Type: text/plain; charset=utf-8 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20260708102341.53919-5-ansuelsmth@gmail.com> References: <20260708102341.53919-1-ansuelsmth@gmail.com> <20260708102341.53919-5-ansuelsmth@gmail.com> Hi Christian, Thanks for working on this. One critical bug found that will crash on probe, plus a couple of minor issues. 1) Uninitialized shared pointer in an7581_phy_probe() The local variable `shared` is declared but never assigned before use: static int an7581_phy_probe(struct phy_device *phydev) { struct airoha_socphy_shared *shared; /* not initialized */ ... ret = devm_phy_package_join(&phydev->mdio.dev, phydev, 0, sizeof(struct airoha_socphy_shared)); if (ret) return ret; ... if (phydev->mdio.addr == AIROHA_DEFAULT_PORT0_ADDR) shared->phydev_p0 = phydev; /* writing to uninitialized pointer */ devm_phy_package_join() allocates the shared priv data internally (accessible via phydev->shared->priv), but the local variable `shared` itself is never populated. You need to call phy_package_get_priv(phydev) after the join succeeds before accessing any shared fields. Fix: shared = phy_package_get_priv(phydev); should be added right after devm_phy_package_join() succeeds. Without this fix, the first PHY to probe (addr == 0x9) will crash, and all subsequent PHYs' config_init will dereference an uninitialized phydev_p0 in every calibration function. 2) Typo: mdi_resister_type -> mdi_resistor_type The field name "resister" appears in multiple places (enum, struct field, config_init, FIXME comments). It should be "resistor". This will be baked into the ABI once merged so worth fixing now: - enum airoha_mdi_resister_type -> airoha_mdi_resistor_type - shared->mdi_resister_type -> shared->mdi_resistor_type - FIXME comment: "MDI Resister Type" -> "MDI Resistor Type" 3) Observation: mdi_resister_type is always MDI_5R but tables have MDI_0R data Currently the code hardcodes mdi_resister_type = MDI_5R, so the MDI_0R entries in an7581_tx_amp_compensation_tbl[] are dead data. The FIXME suggests this should be read from SCU registers eventually. Consider adding the MDI_0R branch now (or at minimum an else) so the code structure is ready when the SCU read is implemented, and avoid shipping dead table data. Best, Wayen