From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail121.out.titan.email (mail121.out.titan.email [54.208.145.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBE7F28369D for ; Tue, 23 Dec 2025 17:41:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.208.145.58 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766511717; cv=none; b=DrI6/x7WDnY2dsRXK+Blu9yMy8mBrFdMNDzeuRmqQPNkbwTD3G5yxxnQgeevk+z2Js6RM3ux+oeywxFZDeBp5dUa93EwVrBz5kfhd9WAR+mpca3ZS1MWzUdVlr2FYOY2xx+vnJmDf/T4O18OBHnwadf1cAs5d0OrmZe4wVIkSAM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766511717; c=relaxed/simple; bh=IJXJ6Z57VDuZGg/JZBuVEZGxL7TV8uWX+NtaLr8YB68=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=J7yurZ34gsAes2urHHv4nyGtfXu6ARjLgCuE1yCB9ZJrtJ5H9Z3ZWLQAG+KIOpxuI9bDPcAEpCDMRgJypk5s8VPdFw1xhdm28XN1V41z66N4mrmVHPYpWkjsIzTwg4dO+hKZzDtU8CP8ZrNE+QIeFBZhLdQfen+2gR/47dndeVM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ziyao.cc; spf=pass smtp.mailfrom=ziyao.cc; dkim=pass (1024-bit key) header.d=ziyao.cc header.i=@ziyao.cc header.b=ZLNcLNW8; arc=none smtp.client-ip=54.208.145.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ziyao.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziyao.cc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ziyao.cc header.i=@ziyao.cc header.b="ZLNcLNW8" Received: from localhost (localhost [127.0.0.1]) by smtp-out.flockmail.com (Postfix) with ESMTP id 4dbMbC2wB1z9rw1; Tue, 23 Dec 2025 17:35:03 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ReuRyugcy/pXsUcDMdPzKlNmSZyRpo0bmzEnZclBDYs=; c=relaxed/relaxed; d=ziyao.cc; h=in-reply-to:from:subject:message-id:references:date:to:cc:mime-version:from:to:cc:subject:date:message-id:in-reply-to:references:reply-to; q=dns/txt; s=titan1; t=1766511303; v=1; b=ZLNcLNW83gLEANYQ0+AUT8So14grOHTSSqIXYj5wNiRWLfnpq1d4eiwYpf7Mnw3us7Wr7j8U D5x94jf6rT6kfNIcUeEzVSPSLWLEoxmzr1MNrzjsq1iaAVUjHrTkSxp1bAI6gA0DZ9wuLbhTkX2 dUVN2fQUvv7lOkiMO6KyIfv8= Received: from pie (unknown [117.171.66.90]) by smtp-out.flockmail.com (Postfix) with ESMTPA id 4dbMb06w4jz9rvq; Tue, 23 Dec 2025 17:34:52 +0000 (UTC) Date: Tue, 23 Dec 2025 17:34:45 +0000 Feedback-ID: :me@ziyao.cc:ziyao.cc:flockmailId From: Yao Zi To: Andrew Lunn Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Frank , Heiner Kallweit , Russell King , "Russell King (Oracle)" , Vladimir Oltean , Choong Yong Liang , Chen-Yu Tsai , Jisheng Zhang , Furong Xu <0x1207@gmail.com>, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Mingcong Bai , Kexy Biscuit , Runhua He , Xi Ruoyao Subject: Re: [RFC PATCH net-next v4 2/3] net: stmmac: Add glue driver for Motorcomm YT6801 ethernet controller Message-ID: References: <20251216180331.61586-1-me@ziyao.cc> <20251216180331.61586-3-me@ziyao.cc> <36d87587-d40d-4258-a05f-b7923aea7982@lunn.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <36d87587-d40d-4258-a05f-b7923aea7982@lunn.ch> X-F-Verdict: SPFVALID X-Titan-Src-Out: 1766511303239934612.21635.5116388274354224215@prod-use1-smtp-out1003. X-CMAE-Score: 0 X-CMAE-Analysis: v=2.4 cv=WtDRMcfv c=1 sm=1 tr=0 ts=694ad2c7 a=rBp+3XZz9uO5KTvnfbZ58A==:117 a=rBp+3XZz9uO5KTvnfbZ58A==:17 a=kj9zAlcOel0A:10 a=MKtGQD3n3ToA:10 a=CEWIc4RMnpUA:10 a=eNeCnQznUAOmK-4rL2EA:9 a=CjuIK1q_8ugA:10 a=3z85VNIBY5UIEeAh_hcH:22 a=NWVoK91CQySWRX1oVYDe:22 On Sun, Dec 21, 2025 at 09:42:20PM +0100, Andrew Lunn wrote: > > +static int motorcomm_efuse_read_patch(struct dwmac_motorcomm_priv *priv, > > + u8 index, > > + struct motorcomm_efuse_patch *patch) > > +{ > > + u8 buf[sizeof(*patch)], offset; > > + int i, ret; > > + > > + for (i = 0; i < sizeof(*patch); i++) { > > + offset = EFUSE_PATCH_REGION_OFFSET + sizeof(*patch) * index + i; > > + > > + ret = motorcomm_efuse_read_byte(priv, offset, &buf[i]); > > + if (ret) > > + return ret; > > + } > > + > > + memcpy(patch, buf, sizeof(*patch)); > > Why do you write it into a temporary buffer and then copy it to patch? > Why not put it straight into patch? Originally I wanted to avoid possible violation of pointer aliasing rules, so write the RAW data to an extra buffer and do a memcpy() later. But we have -fno-strict-aliasing in kernel, even without it accessing any objects with character type should be okay. I'll remove buf and write to patch directly in v5. > > + ret = motorcomm_efuse_read_mac(priv, res.mac); > > + if (ret == -ENOENT) { > > + dev_warn(&pdev->dev, "eFuse contains no valid MAC address\n"); > > + dev_warn(&pdev->dev, "fallback to random MAC address\n"); > > + > > + memset(res.mac, 0, sizeof(res.mac)); > > It is not clear how setting this to zero results in a random MAC > address. Maybe actually call eth_random_addr()? stmmac_check_ether_addr() would generate a random MAC address through eth_random_addr() if res.mac is all zeroes. But I agree calling eth_random_addr() directly here would be clearer, will do it in v5. > Andrew Thanks for your review, happy holiday! Regards, Yao Zi