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 6D5D5C433EF for ; Sun, 23 Jan 2022 00:15:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235972AbiAWAP1 (ORCPT ); Sat, 22 Jan 2022 19:15:27 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38578 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbiAWAOT (ORCPT ); Sat, 22 Jan 2022 19:14:19 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id F2DE360DCB; Sun, 23 Jan 2022 00:14:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A497C340E2; Sun, 23 Jan 2022 00:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642896858; bh=yK29ml3UVDJqS7LpaSmidg+8acUQn0flg4WYId//gpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogqd1nS7tYzS4LKTv10ZUxAUSPVYWL5YVh+d+oTDK+46TqKp/CtDcJGyAwq5/M0uk I+nUVDpR356+h6kO58S3LvTAAQj4GbJ0rRoycwG+QnrqTPb3g03zS/Aj39Z1D3KADK atgPPhXAiUKZdFsp5DBMFt+3PyKmIjJIKYsVNabsh1khcDeNQfw73R1QI+V8OtkW/c nXu7az8N6Ojnr79qQk7ymf9sm2bXpChOBRB9oCopzHQA/OrOA5fdFiA05GMsRXMuUI RuvF3+R6lWjIqRN6B8NJXHR60voLMRvXMa8ItlVTIWkuRw1498pO9XFXXIJX3kDjEp w6o/y1RGfSVVg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michael Ellerman , Jakub Kicinski , "David S . Miller" , Sasha Levin , tanghui20@huawei.com, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 2/4] net: apple: bmac: Fix build since dev_addr constification Date: Sat, 22 Jan 2022 19:14:08 -0500 Message-Id: <20220123001412.2460945-2-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220123001412.2460945-1-sashal@kernel.org> References: <20220123001412.2460945-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman [ Upstream commit ea938248557a52e231a31f338eac4baee36a8626 ] Since commit adeef3e32146 ("net: constify netdev->dev_addr") the bmac driver no longer builds with the following errors (pmac32_defconfig): linux/drivers/net/ethernet/apple/bmac.c: In function ‘bmac_probe’: linux/drivers/net/ethernet/apple/bmac.c:1287:20: error: assignment of read-only location ‘*(dev->dev_addr + (sizetype)j)’ 1287 | dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j]; | ^ Fix it by making the modifications to a local macaddr variable and then passing that to eth_hw_addr_set(). We don't use the existing addr variable because the bitrev8() would mutate it, but it is already used unreversed later in the function. Signed-off-by: Michael Ellerman Reviewed-by: Jakub Kicinski Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/apple/bmac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c index a8b462e1beba6..387fb0d5e288b 100644 --- a/drivers/net/ethernet/apple/bmac.c +++ b/drivers/net/ethernet/apple/bmac.c @@ -1245,6 +1245,7 @@ static int bmac_probe(struct macio_dev *mdev, const struct of_device_id *match) struct bmac_data *bp; const unsigned char *prop_addr; unsigned char addr[6]; + u8 macaddr[6]; struct net_device *dev; int is_bmac_plus = ((int)match->data) != 0; @@ -1292,7 +1293,9 @@ static int bmac_probe(struct macio_dev *mdev, const struct of_device_id *match) rev = addr[0] == 0 && addr[1] == 0xA0; for (j = 0; j < 6; ++j) - dev->dev_addr[j] = rev ? bitrev8(addr[j]): addr[j]; + macaddr[j] = rev ? bitrev8(addr[j]): addr[j]; + + eth_hw_addr_set(dev, macaddr); /* Enable chip without interrupts for now */ bmac_enable_and_reset_chip(dev); -- 2.34.1