From nobody Mon Nov 25 04:49:18 2024 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 5F7A02194A4; Wed, 30 Oct 2024 16:54:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730307245; cv=none; b=VrF7UZTW7wmS3yVpbJcUTF/SWHimuHmw8pX/hAAraX4tRXDgiqC3oAvyywKyQS8ayeXvpANwjqfK5pQw/dwMtdIP85JrAXLwXXHbPykn6V1M58MQcb+vnj409w8SqEMhgNhZfpSXPATooUWgCa192FBpaQW5D6b0hGenLM8feF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730307245; c=relaxed/simple; bh=ZsdCmW4n2LvHHk61rNgVX7raqVKq/pW4WBuFPn32Q2I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DdHPpy1nfXnxhbLyOrzCU4PvCNeMiFRKx9kDC1Kgv6gRvgRSYzzMFRgC56K+E2TUyVOS5gjK1cJCVoF+5PqyvK31puS1Lx04+qOALnwe5J1f4OH/A53W0U6jBm5fwjuL4jyyd5w8kCCFDfkNVSYZKC0L1DOdmEPpzKpFcf1mHxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=OjeSwvRn; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="OjeSwvRn" Received: by mail.gandi.net (Postfix) with ESMTPSA id AA3E0C0009; Wed, 30 Oct 2024 16:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1730307235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZR/OQqXD89qyu5jFhAfZEfAZSUhVQIdWY1c3hbVfIMM=; b=OjeSwvRnaMSFCd46de9Q7uKPnYDwn4SdDNO6fxhk/COFFuPQZIr/bFmjCzX1/tY188URQ8 i2lDTFUvplQEBkSnpY6IorDz30CgovV0DHKR1/qQkQlyIQ57gFy9fHdZ9BO2A1lZvAmEu8 +ArFQt3hY5W8vACe9oOoFbw4xrigIrmtWB+JjIAhl2l6wU1QzwWu4jUqsgsXhKo5nIw3th w6cwwiw2VtAll6KP3Etwc/rPk7Hcf4/EN0nl0mHSfZHyRtuCT0zpA3bTUHtdL4eMHTCtj/ tOW3eHFZGXZenV87CaAXN3vZEE1uR+cFXK5k5QQkNdo6ty1JQlK+sJKyl0MOIw== From: Kory Maincent Date: Wed, 30 Oct 2024 17:53:04 +0100 Subject: [PATCH RFC net-next v2 02/18] net: pse-pd: tps23881: Simplify function returns by removing redundant checks 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241030-feature_poe_port_prio-v2-2-9559622ee47a@bootlin.com> References: <20241030-feature_poe_port_prio-v2-0-9559622ee47a@bootlin.com> In-Reply-To: <20241030-feature_poe_port_prio-v2-0-9559622ee47a@bootlin.com> To: Andrew Lunn , Oleksij Rempel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Donald Hunter , Rob Herring , Andrew Lunn , Simon Horman , Heiner Kallweit , Russell King , Liam Girdwood , Mark Brown Cc: Thomas Petazzoni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, Kyle Swenson , Dent Project , kernel@pengutronix.de, Maxime Chevallier , Kory Maincent X-Mailer: b4 0.15-dev-8cb71 X-GND-Sasl: kory.maincent@bootlin.com From: Kory Maincent (Dent Project) Cleaned up several functions in tps23881 by removing redundant checks on return values at the end of functions. These check has been removed, and the return statement now directly returns the function result, reducing the code's complexity and making it more concise. Reviewed-by: Andrew Lunn Acked-by: Oleksij Rempel Reviewed-by: Kyle Swenson Signed-off-by: Kory Maincent --- drivers/net/pse-pd/tps23881.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c index 5c4e88be46ee..20eab9857817 100644 --- a/drivers/net/pse-pd/tps23881.c +++ b/drivers/net/pse-pd/tps23881.c @@ -118,11 +118,7 @@ static int tps23881_pi_disable(struct pse_controller_d= ev *pcdev, int id) val |=3D BIT(chan + 8); } =20 - ret =3D i2c_smbus_write_word_data(client, TPS23881_REG_PW_EN, val); - if (ret) - return ret; - - return 0; + return i2c_smbus_write_word_data(client, TPS23881_REG_PW_EN, val); } =20 static int tps23881_pi_is_enabled(struct pse_controller_dev *pcdev, int id) @@ -488,7 +484,7 @@ tps23881_write_port_matrix(struct tps23881_priv *priv, struct i2c_client *client =3D priv->client; u8 pi_id, lgcl_chan, hw_chan; u16 val =3D 0; - int i, ret; + int i; =20 for (i =3D 0; i < port_cnt; i++) { pi_id =3D port_matrix[i].pi_id; @@ -519,11 +515,7 @@ tps23881_write_port_matrix(struct tps23881_priv *priv, } =20 /* Write hardware ports matrix */ - ret =3D i2c_smbus_write_word_data(client, TPS23881_REG_PORT_MAP, val); - if (ret) - return ret; - - return 0; + return i2c_smbus_write_word_data(client, TPS23881_REG_PORT_MAP, val); } =20 static int @@ -572,11 +564,7 @@ tps23881_set_ports_conf(struct tps23881_priv *priv, val |=3D BIT(port_matrix[i].lgcl_chan[1]) | BIT(port_matrix[i].lgcl_chan[1] + 4); } - ret =3D i2c_smbus_write_word_data(client, TPS23881_REG_DET_CLA_EN, val); - if (ret) - return ret; - - return 0; + return i2c_smbus_write_word_data(client, TPS23881_REG_DET_CLA_EN, val); } =20 static int @@ -602,11 +590,7 @@ tps23881_set_ports_matrix(struct tps23881_priv *priv, if (ret) return ret; =20 - ret =3D tps23881_set_ports_conf(priv, port_matrix); - if (ret) - return ret; - - return 0; + return tps23881_set_ports_conf(priv, port_matrix); } =20 static int tps23881_setup_pi_matrix(struct pse_controller_dev *pcdev) --=20 2.34.1