From nobody Sun Nov 24 13:55:54 2024 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 EA2D81F7543; Mon, 4 Nov 2024 21:01:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730754094; cv=none; b=NJsct78oPNfgNPLVDYE+wMMO5uDhzc7ByTQ7zQwNmhZ7GihLF/YceHoZjI6M1gkcHfvTkSNIwuowPnRzM5GWhd/+hd1EwRkggUGZ3Pop4DDtLqfwBxeiv7tseaD+IKZ2cSgpRuLGN9JPSS4Edbya92QAmwobvmWbOsTEqcErFSc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730754094; c=relaxed/simple; bh=xHTXt0VJADoQNRT5MVeOmPWjvQOJQeJgXqLgKIr11Zg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NakaNT6TIXnAIclwQoeseTyvAHBd1FL5czuVihYKCtMh3Gn4tmUua22s5pnxClj+WSHmzFQ5bGEyJFQw9aEWw6g+EotRjiNrRBIUMzXxYZhqOWmSOJDRjYn0CpZepiTR7XLyxUNi95fb23cNjkKPEowHjb3Qc0Qo/ZswPMbWDhk= 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=HPyam8BE; arc=none smtp.client-ip=209.85.210.173 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="HPyam8BE" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71e5a62031aso3799973b3a.1; Mon, 04 Nov 2024 13:01:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730754092; x=1731358892; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ip9/C2ewikw3KgUEbRX7k49RSpJtURcwU9L3ZheHKjQ=; b=HPyam8BEyuqY9vIPJYB1c0f9cxO009zOalO7+LWO/PydPPEN0E+9NZeqWq64sYqErA VybHMVYtwScIBUv1wvou6kq3nESPuOkY3OltZWLTULlRbkK9HLBqKqEvtEJb0jC5H/vW b4kJxfmUJrC+34gUFhBmLQssTWEMzo0Qg+t6GTiXjpkVFMJeL2R4rhZTXkekLmK056S1 uStiWXfjz66mARhKi8x2nIMkCAPYeoy44Hqgl8IxqtC+AzmFZuDlIOTqHZZlTzXzB34f tsSLMgECjIeSUY4/XAEYNoN4BpsV8YgyjVC35XckwiotIuvcL1Cpiz/DY4j1FaCcsvgd T+mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730754092; x=1731358892; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ip9/C2ewikw3KgUEbRX7k49RSpJtURcwU9L3ZheHKjQ=; b=Qf9g4TOtSAQ8e0bhrHJ8DwoOGN6T0FMkotrkrm+zSSF02UcJxOaaBkN4DgHRRE7MxW eOaGVvOVdHM4YHBlgBh/LM+dOb/m+PL2JUaDdhaWrjPSB+fNzPPdSV56yyoGQqcWvG7h 9DcN8bY7JWbjxLBXVwxGqlWgoxO6IUKIheqX/xoASZII4xBhcA/WiXJpBeCxUJ5s134h gQmGU5QTBX3wLkmiIImKiejy2GnRExEVHeKzCk7+CQh+GErOdk6MY00VqUgNgtTahmpf VAScwSYMNuaRahiO+TY/i3P4BtWM/28AslECNyJZeej/n06teZ+uLXIgIFZzIuJaw3O8 oDAg== X-Forwarded-Encrypted: i=1; AJvYcCX+ZboGyUDkXfMCtgAqwErmxtK69fo62osqbAUlrUiDSOgj15A6aZIgprjmLBJA9+ncxIS/b0956U/z1hE=@vger.kernel.org X-Gm-Message-State: AOJu0YyttoGOv/76jVjegO0NQejuUACh/y3v2qWe/xEEmIJ3SXLPp1AI jt6TmVsTcLXEoLgrN4dzbJ81OqmmGa1g2T52zbo+o1amOdZE0NqV3oMN2wzV X-Google-Smtp-Source: AGHT+IEnbdG1Ii06AUcv2+s6OlAYE4thaNj7TjcIIQC8s8ZBO9ULIesDRtW5uiZzRUj/PuB2sXQt1g== X-Received: by 2002:a05:6a00:1814:b0:71e:3b51:e850 with SMTP id d2e1a72fcca58-720c98a3d3amr19246643b3a.2.1730754091800; Mon, 04 Nov 2024 13:01:31 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc1b8971sm8307755b3a.12.2024.11.04.13.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 13:01:31 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , maxime.chevallier@bootlin.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linuxppc-dev@lists.ozlabs.org (open list:FREESCALE QUICC ENGINE UCC ETHERNET DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 1/4] net: ucc_geth: use devm for kmemdup Date: Mon, 4 Nov 2024 13:01:24 -0800 Message-ID: <20241104210127.307420-2-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241104210127.307420-1-rosenp@gmail.com> References: <20241104210127.307420-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Avoids manual frees for it. Funny enough the free in _remove should be the last thing done. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/ucc_geth.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethern= et/freescale/ucc_geth.c index a7dd0a2ead86..4bf5ff5642e7 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -3594,22 +3594,23 @@ static int ucc_geth_probe(struct platform_device* o= fdev) if ((ucc_num < 0) || (ucc_num > 7)) return -ENODEV; =20 - ug_info =3D kmemdup(&ugeth_primary_info, sizeof(*ug_info), GFP_KERNEL); - if (ug_info =3D=3D NULL) + ug_info =3D devm_kmemdup(&ofdev->dev, &ugeth_primary_info, + sizeof(*ug_info), GFP_KERNEL); + if (!ug_info) return -ENOMEM; =20 ug_info->uf_info.ucc_num =3D ucc_num; =20 err =3D ucc_geth_parse_clock(np, "rx", &ug_info->uf_info.rx_clock); if (err) - goto err_free_info; + return err; err =3D ucc_geth_parse_clock(np, "tx", &ug_info->uf_info.tx_clock); if (err) - goto err_free_info; + return err; =20 err =3D of_address_to_resource(np, 0, &res); if (err) - goto err_free_info; + return err; =20 ug_info->uf_info.regs =3D res.start; ug_info->uf_info.irq =3D irq_of_parse_and_map(np, 0); @@ -3622,7 +3623,7 @@ static int ucc_geth_probe(struct platform_device* ofd= ev) */ err =3D of_phy_register_fixed_link(np); if (err) - goto err_free_info; + return err; ug_info->phy_node =3D of_node_get(np); } =20 @@ -3751,9 +3752,6 @@ static int ucc_geth_probe(struct platform_device* ofd= ev) of_phy_deregister_fixed_link(np); of_node_put(ug_info->tbi_node); of_node_put(ug_info->phy_node); -err_free_info: - kfree(ug_info); - return err; } =20 @@ -3769,7 +3767,6 @@ static void ucc_geth_remove(struct platform_device* o= fdev) of_phy_deregister_fixed_link(np); of_node_put(ugeth->ug_info->tbi_node); of_node_put(ugeth->ug_info->phy_node); - kfree(ugeth->ug_info); free_netdev(dev); } =20 --=20 2.47.0 From nobody Sun Nov 24 13:55:54 2024 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 4D3931F76A3; Mon, 4 Nov 2024 21:01:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730754095; cv=none; b=hsTjFzwdp9v7W3tg5fPpUY4GW6KS/COqOwDnDO/0U3EyxDULg1idIAucgwPa6bveipHwuWFUeWa6xgmJQamTbpd9nZ6FWPPIdwZ0H3JdEKfcMkjckPWeYb65TOJb5uVgZ514E8GFyvM9Ul/8encCZeWWZS35NsQ3WWqWXUaRsYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730754095; c=relaxed/simple; bh=m4UQ3qookCbEq72M72UpvLW2AP94mcUVoh00RXRBfuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K9nXOv6k6OPzNEGoB7B31foGsNxr1JteYkByvtyBH95HhIKanBJKKTWK03yDvTNtcZdKuSfnctQJqXjFuqlekGE0Kg3MlRO0oHdCOiRp0HF5MFPJH2y6tGzifI3BXiKCsIa5dxbXrnavHKBay+juUY6f6kR61pLVCAvknurh8y8= 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=ng2TI9SC; arc=none smtp.client-ip=209.85.210.174 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="ng2TI9SC" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-71e52582cf8so3994173b3a.2; Mon, 04 Nov 2024 13:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730754093; x=1731358893; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+bIZ8zF+L8MJ4yRKB9h8E75aKwY9cSMENvoX7DOPics=; b=ng2TI9SCcNm5vPDJpwe5khxlQYlzvNgAw6IjkOHS/ML0uC8bz3eknwGnR11S9s/s0I rDWFlWzXumhgsj3qIkz3CyRHBNzmqH6+lu5ZtsfpiBQ/gosvOfxsdicS3mggzlECb2WL LP9WOT4sKj4bOrO627i3HUQrdudMXzDBM92ptMrPtjnBIhtHoOMZy773qjvORIIDRaIU O0Jcp+emZfKly2ykv0MVCSKBzr32Wpok9yR3IeLBwBBRExNpy00XYVsAvuExy98jIOj5 R/aC2WmvnzRN1C4WSBKwb4FVjnQT0FPsLp8/gUbmB0s1biron7AQhpzqwyqiCgVf3JcL hb8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730754093; x=1731358893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+bIZ8zF+L8MJ4yRKB9h8E75aKwY9cSMENvoX7DOPics=; b=pOD8gAMse2q6YcZG2TmuJyG/qC/ROpLuz2LMxmn+8bBmCuRzwLovlhtuBe/eUZPKpY GeYl00k9QYl5nEyKcv9FXj5HPh2wwIWok0qk0Cz0K4ZVBN/uJpbYvP3bvPkT4Li2YlGv RmazW0lMBMs6hT26a5kFvORrm9nqTghknq7X80/h5L+3A2+1/LcOEunSvzU7LRWUWXnW 3B+vO7L3DQ+8bgisNrczH5vSlnNCHddeajQ2i+3YrDZ1zHz18oPGbMLA2s0mhSafwcMe 4aEyOjiOal6Dw2YMfaW48b+y6gVyaUJSMOfHbNFtUPBRdll4n/k4yJegZovUdJ0rpsf4 Cfbw== X-Forwarded-Encrypted: i=1; AJvYcCVay+WGkvVwpw8+sourHuTOvgoO0lIWu2dP3SK7xbGtfYrrhXBKdPWf7bd8YrmRaeYapFd6a4iEL7K9cVI=@vger.kernel.org X-Gm-Message-State: AOJu0YwC/v2HVzvCzR7emGM3jQrwpc7+CbMOPsG74v10NRTO6JacZkOC DtAYYNXmfalHOMjz6LKj61qLkEeum48/cj9DkRfHNrdMs0ejS2N5OulUTZ7P X-Google-Smtp-Source: AGHT+IHvyohNo16U96R1KwDf+tb8U7yjZoIHw3NSm12/Rem7Lvwp3HRybPvr/i8cZs2/qOPlSvCccQ== X-Received: by 2002:a05:6a00:8cf:b0:71e:3b8f:92e with SMTP id d2e1a72fcca58-720c98a3b4amr19231161b3a.3.1730754093280; Mon, 04 Nov 2024 13:01:33 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc1b8971sm8307755b3a.12.2024.11.04.13.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 13:01:32 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , maxime.chevallier@bootlin.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linuxppc-dev@lists.ozlabs.org (open list:FREESCALE QUICC ENGINE UCC ETHERNET DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 2/4] net: ucc_geth: use devm for alloc_etherdev Date: Mon, 4 Nov 2024 13:01:25 -0800 Message-ID: <20241104210127.307420-3-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241104210127.307420-1-rosenp@gmail.com> References: <20241104210127.307420-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Avoids manual frees. Removes one goto. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/ucc_geth.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethern= et/freescale/ucc_geth.c index 4bf5ff5642e7..00b868a47fd2 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -3691,9 +3691,8 @@ static int ucc_geth_probe(struct platform_device* ofd= ev) ug_info->uf_info.irq); =20 /* Create an ethernet device instance */ - dev =3D alloc_etherdev(sizeof(*ugeth)); - - if (dev =3D=3D NULL) { + dev =3D devm_alloc_etherdev(&ofdev->dev, sizeof(*ugeth)); + if (!dev) { err =3D -ENOMEM; goto err_deregister_fixed_link; } @@ -3733,7 +3732,7 @@ static int ucc_geth_probe(struct platform_device* ofd= ev) if (netif_msg_probe(ugeth)) pr_err("%s: Cannot register net device, aborting\n", dev->name); - goto err_free_netdev; + goto err_deregister_fixed_link; } =20 of_get_ethdev_address(np, dev); @@ -3745,8 +3744,6 @@ static int ucc_geth_probe(struct platform_device* ofd= ev) =20 return 0; =20 -err_free_netdev: - free_netdev(dev); err_deregister_fixed_link: if (of_phy_is_fixed_link(np)) of_phy_deregister_fixed_link(np); @@ -3767,7 +3764,6 @@ static void ucc_geth_remove(struct platform_device* o= fdev) of_phy_deregister_fixed_link(np); of_node_put(ugeth->ug_info->tbi_node); of_node_put(ugeth->ug_info->phy_node); - free_netdev(dev); } =20 static const struct of_device_id ucc_geth_match[] =3D { --=20 2.47.0 From nobody Sun Nov 24 13:55:54 2024 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 CB35F1F76CD; Mon, 4 Nov 2024 21:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730754097; cv=none; b=gRmKETQTyDTy3OlREOl/s0suLngE/ApEyhvGtHuIwna8r2ePtJSVoBkT66uiTD11kmde+dDXwmuGqKIQb2L+r8U7GtlF82ZH8cAWt3iO8LJEwwJZZP2AgM2SUBzBRA7Bm7t3aYPcT6dHbBCZONbZdol+WRGZluiOMVN6bU4atAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730754097; c=relaxed/simple; bh=nI32LhZou+0S1DtBINellaUeGTTNXZIygb/ooRu11aA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=obDZnaxkWemva0aP5MhZatamWcVatOUJPgzwrlANzbQu/iucCvf3AZNUUMKhsGKmFkZFMYQWzLHuu7WU1KOGhIhv5SF4rXhscNhn3LBOqbYY3AglYcmnlJNl11fuNLKwJSu2JMonjxFd2NOQoH3znQbGiF0GJYptjohKsXJEFvg= 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=aKHiv3g8; arc=none smtp.client-ip=209.85.210.173 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="aKHiv3g8" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71e625b00bcso4237214b3a.3; Mon, 04 Nov 2024 13:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730754095; x=1731358895; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4pXKZHXAtSZq9rE1V/pmNjGOdaYBnGBtC8hqbRoKbqU=; b=aKHiv3g8aiEInq1sNOtDaZfxwj7hNzrFqi4ayE/d2Hsmkn+VHqbuC7hUkw9Ba2bfCr j6kD38spMUbdOWHgMKfJAnhQKzbDKjnEmyNPYMB/0a/x1tQdcwQC2egQvLhFUnHL6bMr UW7xD1wqjt+M01vjcfPtVyS9nF09XKVsvsES6rByf3PwB2fJPYysAmbf52nIk4xQwrRB /tLUMBCYgn/qsqbweIHLs7Id3/6zq2ELW1lVGm9XadyEz3zys1yG1ZVkFWkTld9pcl7e zVyIG7M8DyMBZ38985K1wJR7BIZu9ll4CAl00v6ZEZXSL/DqDnZ81ltkvew+N1GYN9kx UReg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730754095; x=1731358895; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4pXKZHXAtSZq9rE1V/pmNjGOdaYBnGBtC8hqbRoKbqU=; b=KhCzGiAXpEqvDbKfbUi2xTIHci8pMERlK9xuB1G5TH7ee43wRmNoAX8v5snCa/p2p5 +5dBTcLlvf/0EWDg+EE5k4kjLatz96oJuZItEiDveqUdTaC8LYR33cPPYO7gXDjirD6c g5NPp3APPmsNP4Ycd8PrNEAttLi6V7hCqWX9KIcCBgAPfE4Kdof5BWrFz1c9SG62NCCB SfgfLcE/wDtq+6P5dZVtf33Z+699Wk8C5BE0mQskhLRQT3z0VdMIRG6Zx8uKC35Bb4Vr RoPNQ9seYzNz52y5e7n4Vm3Robck/OS0wKqMn2dtoiz5MIHksKBoHjrmN7xchy2+y3Cd zn+w== X-Forwarded-Encrypted: i=1; AJvYcCX6n3OMFSz1wVVaBjp/RQO5bfd5QkeKTCWdcbIUMu9PrTxyf69b2r1moG3M6wT9aGputPEl8EN0F76MfSo=@vger.kernel.org X-Gm-Message-State: AOJu0YzYW+3Fm97u1rMXnMO9yIKDQKUjvbHRxRuYzlgaFhtMx+9M5yCh 4oe+2YHHLn1Amji/MgCSRjPgsACImYnSHYwcXU7kEIqfSwyaHZ2gOsCT20lM X-Google-Smtp-Source: AGHT+IGVOiJFQcleE+NLyWRmjQbIlc5so8HKh80FTo3HLnTFS4d9spw/T8UmVR69HQs88bShBPOJpQ== X-Received: by 2002:a05:6a00:2302:b0:71e:6c65:e7c4 with SMTP id d2e1a72fcca58-720b9de1608mr21369867b3a.26.1730754094875; Mon, 04 Nov 2024 13:01:34 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc1b8971sm8307755b3a.12.2024.11.04.13.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 13:01:34 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , maxime.chevallier@bootlin.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linuxppc-dev@lists.ozlabs.org (open list:FREESCALE QUICC ENGINE UCC ETHERNET DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 3/4] net: ucc_geth: use devm for register_netdev Date: Mon, 4 Nov 2024 13:01:26 -0800 Message-ID: <20241104210127.307420-4-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241104210127.307420-1-rosenp@gmail.com> References: <20241104210127.307420-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Avoids having to unregister manually. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/ucc_geth.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethern= et/freescale/ucc_geth.c index 00b868a47fd2..88a9e7db687c 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -3727,7 +3727,7 @@ static int ucc_geth_probe(struct platform_device* ofd= ev) /* Carrier starts down, phylib will bring it up */ netif_carrier_off(dev); =20 - err =3D register_netdev(dev); + err =3D devm_register_netdev(&ofdev->dev, dev); if (err) { if (netif_msg_probe(ugeth)) pr_err("%s: Cannot register net device, aborting\n", @@ -3758,7 +3758,6 @@ static void ucc_geth_remove(struct platform_device* o= fdev) struct ucc_geth_private *ugeth =3D netdev_priv(dev); struct device_node *np =3D ofdev->dev.of_node; =20 - unregister_netdev(dev); ucc_geth_memclean(ugeth); if (of_phy_is_fixed_link(np)) of_phy_deregister_fixed_link(np); --=20 2.47.0 From nobody Sun Nov 24 13:55:54 2024 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 9A6471F80C6; Mon, 4 Nov 2024 21:01:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730754099; cv=none; b=ZDTrXGKcwvXCSclqh3ubyQPlzFm916dJQ1XsdJMzQyXNoUMQHj+heIETXoV0m4evgXPJNvSdf0j3MrqRwEKKVENvjH2AAf75tRm8hl3UReSMYUz6YjkGS+ypK2U5AM4b1Ch4TbH3BPyjEYi3CToqZPlX7A6DEVojn4kCDIZlwPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730754099; c=relaxed/simple; bh=OxRINzWdRircfPeLvtQUkVRBFmCoiRjSQgjI31+NbKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OkWWNI2HTxMCuxgJg5zhOpbRuWV+QOFAF0pt460ATXCsXChnNROpnAtbFFEXeuIkOlSFVhtcxiG33KPznWhV1eYiiWF8Ke4OMf+Aj6H+CMuJ5xlxNchWOTD2Pxd8of4BTKLL3MnihjUo3SACVJMHKPA6sR6CtEpn9dbP4ROoxN4= 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=G5MRBVmb; arc=none smtp.client-ip=209.85.210.172 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="G5MRBVmb" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-720be2b27acso3839516b3a.0; Mon, 04 Nov 2024 13:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730754097; x=1731358897; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HB0r+fmFtPPP2FUicFB9grwBKEnYit58WrhtOqLd8qs=; b=G5MRBVmb/+EfQsC1LTnUi7WkeJnrhWYEu/cZ0XYDPtNaff1EVGSzvmbo01RK3SsGlb TXKHlOO+hXB69WgXPGH63yVj7jIucMounmDDZHi4blfYw1+hHYV1T3MmclguTbql1zKV CxLh1omn8PEIWzXAYi011L0YXQWwC/Gme2aUWl1uCUyWIqzzBNpDLLQDipqKpCV3p3Js HVAdUE76ZzzwZ+jYtoDdwr1JFLehWLKV2xDW8A0v4qmY2gbl/ypaCPWr7lenYwF88uHY OZvQ4n6OZxEXfZNEw2oYvxMTsLSYdufxBGgTWEqYBLCUh9PGJWa5UU4oLpxJ6zYWdseJ wd0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730754097; x=1731358897; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HB0r+fmFtPPP2FUicFB9grwBKEnYit58WrhtOqLd8qs=; b=tSIE8ST0paJmX3g9iBawyMlG4nCwOGyZUYzssgq2i0OkPvVECr9gNRUYl6Js+H9g34 PY3WWynWeM19vFjh17QNoIYgN9F3QTxr49vbTU6hjVH9RKbiss97YAZGbv8xuEB9dfoV LVl9MAD/wed0UrUgYXuKUVpo8SSImgwsEiIy4xlCYHYsCdfZQLc+TexmYlkZYp1NflI6 jqHB6UcwHjiOvg322SFexRlMAvYzRubpeMG4zHq1aZQOiDeEUBBAGuqmDOGrGQE2Jnnn cZrBzupVFaj7oojBsMgBRN9vjsouMOUIe9zqSm5XoFyBl5uSF91ppV5dxcwyAXr//dAC ksiw== X-Forwarded-Encrypted: i=1; AJvYcCUT3Rn8Uoxubg+/XI9ZX/bviAQk1lSEdY/dT+GI5FzQfbn56uOfdZJe4GCt8YCC5L/4lS2lDh29egMQDkY=@vger.kernel.org X-Gm-Message-State: AOJu0YzgwB8nMLzEJTR2SpiEBTsnM5vQgrtY4TlC8c0j5eIvgLc9XlPK 35PLKgN+cbjqJ22fho0s0JYk8g0ZdTeTx508knxhI2uCm8ASNM7aFNxM0VQz X-Google-Smtp-Source: AGHT+IGwMD0UoRgk5kv/dUnGGU4iyNpQ/ODgMyjPi1OiOmbCLzk45IZoztu6i5o/DRbm+JHdKLu80w== X-Received: by 2002:a05:6a20:d525:b0:1d9:1bde:bf8 with SMTP id adf61e73a8af0-1db91d87351mr22961733637.14.1730754096456; Mon, 04 Nov 2024 13:01:36 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc1b8971sm8307755b3a.12.2024.11.04.13.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 13:01:35 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , maxime.chevallier@bootlin.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linuxppc-dev@lists.ozlabs.org (open list:FREESCALE QUICC ENGINE UCC ETHERNET DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 4/4] net: ucc_geth: fix usage with NVMEM MAC address Date: Mon, 4 Nov 2024 13:01:27 -0800 Message-ID: <20241104210127.307420-5-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241104210127.307420-1-rosenp@gmail.com> References: <20241104210127.307420-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When nvmem is not ready, of_get_ethdev_address returns -EPROBE_DEFER. In such a case, return -EPROBE_DEFER to avoid not having a proper MAC address. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/ucc_geth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethern= et/freescale/ucc_geth.c index 88a9e7db687c..30453a20e467 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -3735,7 +3735,9 @@ static int ucc_geth_probe(struct platform_device* ofd= ev) goto err_deregister_fixed_link; } =20 - of_get_ethdev_address(np, dev); + err =3D of_get_ethdev_address(np, dev); + if (err =3D=3D -EPROBE_DEFER) + goto err_deregister_fixed_link; =20 ugeth->ug_info =3D ug_info; ugeth->dev =3D device; --=20 2.47.0