Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp237144lqt; Thu, 6 Jun 2024 01:57:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjPsM4CV09BdGbU7TBRxb/6s/gK1rGQiSX+VnIPVSSGtOuftcoZJo6PKMtDPxOcE7SWQDRt7zauyJaVcrOHK+BwXo50BzbROCX4wi3eQ== X-Google-Smtp-Source: AGHT+IG+2HBTHisBkwebbPvfnx0PFejN2QXLKyqzN7Jm7mVtJ4orxLvWEheIzfEvefCP6KsHwIVY X-Received: by 2002:a50:d7ca:0:b0:57a:4af6:319d with SMTP id 4fb4d7f45d1cf-57a8b676fffmr3020558a12.9.1717664231776; Thu, 06 Jun 2024 01:57:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717664231; cv=pass; d=google.com; s=arc-20160816; b=0T9+asjlpsLKbBYBsiQAv881b97kHL2E8LOobqF9CQbfzjEk6thzEtOVFNWaMHoGqb W7yP2KyiZWPJUBPT6zELnOmxZxrRXoqdMIc8FOBP37c+GZjjgPUc2kCyZPHQDm8xCC0v 1rGLzsQjn3zbPruCdtEI+PWRqpVR/wk4yxw71Hnfr35U8Mdeq5eaBpWYyPvdvZFsZ1G6 NWND6uTEgt5QU1P+07aB3EP5s/2TJtLc2nlPP1qlQIqmQKaB7mHgFRJfAm5SNvBwH5Tn Fb907IVx5x78sfe1efoD+uvLpjlyR3Nh/AuFmhoaKR0mav4MzPJ1QYe1oEMf8HQMqwOF KuiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=cvFbc+S24OlsOCKBS5EGAYP1fFaPCKnt/uGGBZPBhB4=; fh=v3SCYaeCJa93a+n0Uxo5VFFPo3sWNiBtrk6VU3AZNuM=; b=nj2OBvZLrsPQX7HO6fpP8X+pRBaUvWrGdDx3aR2NQt+PEAZoGlrKZFZbPoqFxViSs4 Vh3WOR5UU7CxyVwgT9RP30EHLa7kVvFGCNeizIT5MCe6bq/PVDpxaGHxpszimwd6wjgP DbXMW/eMGNl5CmPk5y9ifVjYCsyXtMz2lAygXrINChv63voTudqQBbX0Z/lBPhBHnXX6 Bpek1hOtjS9wl6IyZeLPNGE5BQutMXYWFjQzXut9Y17Jlpu5kxhSa4Kh+NnQ4dcHKpLj Phs9+Nrk8vQbyevObF0glVCkv4T3JgpN5SxuWxIY8bobTQ58iKMm2RWnoLCZ/xaOzRPw rrQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=dev.tdt.de); spf=pass (google.com: domain of linux-kernel+bounces-203896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203896-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae1fe04fsi497245a12.236.2024.06.06.01.57.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 01:57:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=dev.tdt.de); spf=pass (google.com: domain of linux-kernel+bounces-203896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203896-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 564D11F23180 for ; Thu, 6 Jun 2024 08:57:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 250A0146A85; Thu, 6 Jun 2024 08:54:23 +0000 (UTC) Received: from mxout70.expurgate.net (mxout70.expurgate.net [194.37.255.70]) (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 C303A14036B; Thu, 6 Jun 2024 08:54:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.37.255.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717664062; cv=none; b=ahXQhrchCJ5O1I3CWAae3TqTo4ko8XQPmWPrxqdVxBcy3tsqnsRK3RLpShZVmjEph5rv7qARnGlhS9IQQK4geUFcTvhB7a3jAgiFHmYtkK/++3ybPAkpg+DfFIool+o+dgkxveQPZS9VmQlywph4zJFI6NPmYMkq3LoQO7Z2mJc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717664062; c=relaxed/simple; bh=66urcvoEApM1CzR497m8zafhOLZ1hN5H/7AOLh3HeQw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=raYrrnxAfjf3y9RZqEN7rOVIOudFzg4KmMM8cy3KF4zPLrTVy5MAFFfmjiTV1/oEskLqzjk4a2D82uwqGAXGIJdeMPBm+yrVghzn5rrvtdMA9Kiwqo81poWcJtsLs0n4q1XzoE+xT/h2VSS/sSTo/VUMwb2d/dqv25ZvxwKd4HM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dev.tdt.de; spf=pass smtp.mailfrom=dev.tdt.de; arc=none smtp.client-ip=194.37.255.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dev.tdt.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dev.tdt.de Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1sF8t0-00C3w0-Aw; Thu, 06 Jun 2024 10:54:18 +0200 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sF8sz-008wpl-PX; Thu, 06 Jun 2024 10:54:17 +0200 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id 7E49B240053; Thu, 6 Jun 2024 10:54:17 +0200 (CEST) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 1299B240050; Thu, 6 Jun 2024 10:54:17 +0200 (CEST) Received: from mschiller1.dev.tdt.de (unknown [10.2.3.20]) by mail.dev.tdt.de (Postfix) with ESMTPSA id A6DD6379F6; Thu, 6 Jun 2024 10:54:16 +0200 (CEST) From: Martin Schiller To: martin.blumenstingl@googlemail.com, hauke@hauke-m.de, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 03/13] net: dsa: lantiq_gswip: Use dev_err_probe where appropriate Date: Thu, 6 Jun 2024 10:52:24 +0200 Message-ID: <20240606085234.565551-4-ms@dev.tdt.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240606085234.565551-1-ms@dev.tdt.de> References: <20240606085234.565551-1-ms@dev.tdt.de> 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 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151534::1717664058-F1FD4148-1CAA412A/0/0 From: Martin Blumenstingl dev_err_probe() can be used to simplify the existing code. Also it means we get rid of the following warning which is seen whenever the PMAC (Ethernet controller which connects to GSWIP's CPU port) has not been probed yet: gswip 1e108000.switch: dsa switch register failed: -517 Signed-off-by: Martin Blumenstingl --- drivers/net/dsa/lantiq_gswip.c | 53 ++++++++++++++++------------------ 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswi= p.c index b9c7076ce32f..fcb5929c9c88 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -1931,11 +1931,9 @@ static int gswip_gphy_fw_load(struct gswip_priv *p= riv, struct gswip_gphy_fw *gph msleep(200); =20 ret =3D request_firmware(&fw, gphy_fw->fw_name, dev); - if (ret) { - dev_err(dev, "failed to load firmware: %s, error: %i\n", - gphy_fw->fw_name, ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "failed to load firmware: %s\n", + gphy_fw->fw_name); =20 /* GPHY cores need the firmware code in a persistent and contiguous * memory area with a 16 kB boundary aligned start address. @@ -1948,9 +1946,9 @@ static int gswip_gphy_fw_load(struct gswip_priv *pr= iv, struct gswip_gphy_fw *gph dev_addr =3D ALIGN(dma_addr, XRX200_GPHY_FW_ALIGN); memcpy(fw_addr, fw->data, fw->size); } else { - dev_err(dev, "failed to alloc firmware memory\n"); release_firmware(fw); - return -ENOMEM; + return dev_err_probe(dev, -ENOMEM, + "failed to alloc firmware memory\n"); } =20 release_firmware(fw); @@ -1977,8 +1975,8 @@ static int gswip_gphy_fw_probe(struct gswip_priv *p= riv, =20 gphy_fw->clk_gate =3D devm_clk_get(dev, gphyname); if (IS_ERR(gphy_fw->clk_gate)) { - dev_err(dev, "Failed to lookup gate clock\n"); - return PTR_ERR(gphy_fw->clk_gate); + return dev_err_probe(dev, PTR_ERR(gphy_fw->clk_gate), + "Failed to lookup gate clock\n"); } =20 ret =3D of_property_read_u32(gphy_fw_np, "reg", &gphy_fw->fw_addr_offse= t); @@ -1998,8 +1996,8 @@ static int gswip_gphy_fw_probe(struct gswip_priv *p= riv, gphy_fw->fw_name =3D priv->gphy_fw_name_cfg->ge_firmware_name; break; default: - dev_err(dev, "Unknown GPHY mode %d\n", gphy_mode); - return -EINVAL; + return dev_err_probe(dev, -EINVAL, "Unknown GPHY mode %d\n", + gphy_mode); } =20 gphy_fw->reset =3D of_reset_control_array_get_exclusive(gphy_fw_np); @@ -2050,8 +2048,9 @@ static int gswip_gphy_fw_list(struct gswip_priv *pr= iv, priv->gphy_fw_name_cfg =3D &xrx200a2x_gphy_data; break; default: - dev_err(dev, "unknown GSWIP version: 0x%x", version); - return -ENOENT; + return dev_err_probe(dev, -ENOENT, + "unknown GSWIP version: 0x%x", + version); } } =20 @@ -2059,10 +2058,9 @@ static int gswip_gphy_fw_list(struct gswip_priv *p= riv, if (match && match->data) priv->gphy_fw_name_cfg =3D match->data; =20 - if (!priv->gphy_fw_name_cfg) { - dev_err(dev, "GPHY compatible type not supported"); - return -ENOENT; - } + if (!priv->gphy_fw_name_cfg) + return dev_err_probe(dev, -ENOENT, + "GPHY compatible type not supported"); =20 priv->num_gphy_fw =3D of_get_available_child_count(gphy_fw_list_np); if (!priv->num_gphy_fw) @@ -2163,8 +2161,8 @@ static int gswip_probe(struct platform_device *pdev= ) return -EINVAL; break; default: - dev_err(dev, "unknown GSWIP version: 0x%x", version); - return -ENOENT; + return dev_err_probe(dev, -ENOENT, + "unknown GSWIP version: 0x%x", version); } =20 /* bring up the mdio bus */ @@ -2172,28 +2170,27 @@ static int gswip_probe(struct platform_device *pd= ev) if (gphy_fw_np) { err =3D gswip_gphy_fw_list(priv, gphy_fw_np, version); of_node_put(gphy_fw_np); - if (err) { - dev_err(dev, "gphy fw probe failed\n"); - return err; - } + if (err) + return dev_err_probe(dev, err, + "gphy fw probe failed\n"); } =20 /* bring up the mdio bus */ err =3D gswip_mdio(priv); if (err) { - dev_err(dev, "mdio probe failed\n"); + dev_err_probe(dev, err, "mdio probe failed\n"); goto gphy_fw_remove; } =20 err =3D dsa_register_switch(priv->ds); if (err) { - dev_err(dev, "dsa switch register failed: %i\n", err); + dev_err_probe(dev, err, "dsa switch registration failed\n"); goto gphy_fw_remove; } if (!dsa_is_cpu_port(priv->ds, priv->hw_info->cpu_port)) { - dev_err(dev, "wrong CPU port defined, HW only supports port: %i", - priv->hw_info->cpu_port); - err =3D -EINVAL; + err =3D dev_err_probe(dev, -EINVAL, + "wrong CPU port defined, HW only supports port: %i", + priv->hw_info->cpu_port); goto disable_switch; } =20 --=20 2.39.2