From patchwork Wed Oct 2 16:27:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kory Maincent X-Patchwork-Id: 13820054 X-Patchwork-Delegate: kuba@kernel.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 C23BF1D0E1F; Wed, 2 Oct 2024 16:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727886551; cv=none; b=enFEnNPH1kLzE6yxgCy4AK0LUnNW5Dq7oDGImAfZkwasvdUCLOgK+dt+eKByxIUKj+Koi6FJrKLZXiuymzrDwvVi1UzZHwTtoW4AEiqy3FXKY9shrjUU/V3HXWjksopsLBJfqvBAi/VAmmpPhS32q2csIaIw4njfjcp6euHtD6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727886551; c=relaxed/simple; bh=OV/RdTYEnlbC3pry5KNHKsetn+/sjren2tP879uTa5Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z3Vh9gxwiDm1uVkssOsCdAnGeY0m4RjbykaU8Ig6F/TB5mNOExy5/pMKwnIzebfrG5Di2Pv50UOy6ZIQPPW+J0GL2Z9gdwiNJskZ6nS+qouQ0EMC6gDWdDxSNr7cTHCUr8dbBWytkS3GrGmRM+y/cSnjTZEQsuVlDLZqXsXjA6k= 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=N1MrWj6h; arc=none smtp.client-ip=217.70.183.201 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="N1MrWj6h" Received: by mail.gandi.net (Postfix) with ESMTPSA id 80D4D1BF208; Wed, 2 Oct 2024 16:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1727886548; 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=5ePH3amKbdbo1+SFMAbJyxHZ4YiapYq55nJZg7ttGFg=; b=N1MrWj6h9qj41DipZkRoo/OFRgxNbvpAKvmI+Rk10vHGl/kyto16dFcEU7lsG1kJ4/5jed IXrwjKzHbOayIS28cqUJ3n4If9flEKJarXRh0OMHeVa0H7F/v7ihKulR3v5Rj/zwlcAxmx PM8nnK43TyQghVWTww4D/AXYZzIVCnZhk+WAvI6Ldv1L0xZeok1qgzQ4I+gdR5GyRFoYJU b3ELvqDvRxQmwQS6/FTuA8GhYV0lSGmjkatu+uVk8AytmQWnAqkoBRfwAMLvGIYe8rVLjo y97F63yFCeN6dZAueL5jtQOa7P9K9CZR9sxCLxpsO5DvDbSo+6Tlk21JlrSbcQ== From: Kory Maincent Date: Wed, 02 Oct 2024 18:27:59 +0200 Subject: [PATCH net-next 03/12] net: pse-pd: tps23881: Simplify function returns by removing redundant checks Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241002-feature_poe_port_prio-v1-3-787054f74ed5@bootlin.com> References: <20241002-feature_poe_port_prio-v1-0-787054f74ed5@bootlin.com> In-Reply-To: <20241002-feature_poe_port_prio-v1-0-787054f74ed5@bootlin.com> To: Oleksij Rempel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Donald Hunter Cc: Thomas Petazzoni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, Kyle Swenson , Dent Project , kernel@pengutronix.de, Kory Maincent X-Mailer: b4 0.15-dev-8cb71 X-GND-Sasl: kory.maincent@bootlin.com X-Patchwork-Delegate: kuba@kernel.org 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. Signed-off-by: Kory Maincent Reviewed-by: Andrew Lunn Acked-by: Oleksij Rempel --- 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 1a57c55f8577..fdf996f5d1f8 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_dev *pcdev, int id) val |= BIT(chan + 8); } - ret = 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); } 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 = priv->client; u8 pi_id, lgcl_chan, hw_chan; u16 val = 0; - int i, ret; + int i; for (i = 0; i < port_cnt; i++) { pi_id = port_matrix[i].pi_id; @@ -519,11 +515,7 @@ tps23881_write_port_matrix(struct tps23881_priv *priv, } /* Write hardware ports matrix */ - ret = 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); } static int @@ -572,11 +564,7 @@ tps23881_set_ports_conf(struct tps23881_priv *priv, val |= BIT(port_matrix[i].lgcl_chan[1]) | BIT(port_matrix[i].lgcl_chan[1] + 4); } - ret = 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); } static int @@ -602,11 +590,7 @@ tps23881_set_ports_matrix(struct tps23881_priv *priv, if (ret) return ret; - ret = tps23881_set_ports_conf(priv, port_matrix); - if (ret) - return ret; - - return 0; + return tps23881_set_ports_conf(priv, port_matrix); } static int tps23881_setup_pi_matrix(struct pse_controller_dev *pcdev)