public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, michael.chan@broadcom.com,
	jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com,
	tariqt@nvidia.com, saeedm@nvidia.com, leon@kernel.org,
	idosch@nvidia.com, petrm@nvidia.com, simon.horman@corigine.com,
	aelior@marvell.com, manishc@marvell.com,
	jacob.e.keller@intel.com, gal@nvidia.com,
	yinjun.zhang@corigine.com, fei.qin@corigine.com,
	Niklas.Cassel@wdc.com
Subject: [patch net-next v2 07/12] devlink: make devlink_param_driverinit_value_set() return void
Date: Thu, 26 Jan 2023 08:58:33 +0100	[thread overview]
Message-ID: <20230126075838.1643665-8-jiri@resnulli.us> (raw)
In-Reply-To: <20230126075838.1643665-1-jiri@resnulli.us>

From: Jiri Pirko <jiri@nvidia.com>

devlink_param_driverinit_value_set() currently returns int with possible
error, but no user is checking it anyway. The only reason for a fail is
a driver bug. So convert the function to return void and put WARN_ONs
on error paths.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
---
 include/net/devlink.h  |  4 ++--
 net/devlink/leftover.c | 15 +++++++--------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/include/net/devlink.h b/include/net/devlink.h
index cf74b6391896..e0d773dfa637 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -1775,8 +1775,8 @@ void devlink_params_unregister(struct devlink *devlink,
 			       size_t params_count);
 int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
 				       union devlink_param_value *init_val);
-int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
-				       union devlink_param_value init_val);
+void devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
+					union devlink_param_value init_val);
 void devlink_param_value_changed(struct devlink *devlink, u32 param_id);
 struct devlink_region *devl_region_create(struct devlink *devlink,
 					  const struct devlink_region_ops *ops,
diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
index fca2b6661362..693470af548f 100644
--- a/net/devlink/leftover.c
+++ b/net/devlink/leftover.c
@@ -10931,18 +10931,18 @@ EXPORT_SYMBOL_GPL(devlink_param_driverinit_value_get);
  *	This function should be used by the driver to set driverinit
  *	configuration mode default value.
  */
-int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
-				       union devlink_param_value init_val)
+void devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
+					union devlink_param_value init_val)
 {
 	struct devlink_param_item *param_item;
 
 	param_item = devlink_param_find_by_id(&devlink->param_list, param_id);
-	if (!param_item)
-		return -EINVAL;
+	if (WARN_ON(!param_item))
+		return;
 
-	if (!devlink_param_cmode_is_supported(param_item->param,
-					      DEVLINK_PARAM_CMODE_DRIVERINIT))
-		return -EOPNOTSUPP;
+	if (WARN_ON(!devlink_param_cmode_is_supported(param_item->param,
+						      DEVLINK_PARAM_CMODE_DRIVERINIT)))
+		return;
 
 	if (param_item->param->type == DEVLINK_PARAM_TYPE_STRING)
 		strcpy(param_item->driverinit_value.vstr, init_val.vstr);
@@ -10951,7 +10951,6 @@ int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
 	param_item->driverinit_value_valid = true;
 
 	devlink_param_notify(devlink, 0, param_item, DEVLINK_CMD_PARAM_NEW);
-	return 0;
 }
 EXPORT_SYMBOL_GPL(devlink_param_driverinit_value_set);
 
-- 
2.39.0


  parent reply	other threads:[~2023-01-26  7:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26  7:58 [patch net-next v2 00/12] devlink: Cleanup params usage Jiri Pirko
2023-01-26  7:58 ` [patch net-next v2 01/12] net/mlx5: Change devlink param register/unregister function names Jiri Pirko
2023-01-26  7:58 ` [patch net-next v2 02/12] net/mlx5: Covert devlink params registration to use devlink_params_register/unregister() Jiri Pirko
2023-01-26  7:58 ` [patch net-next v2 03/12] devlink: make devlink_param_register/unregister static Jiri Pirko
2023-01-26  7:58 ` [patch net-next v2 04/12] devlink: don't work with possible NULL pointer in devlink_param_unregister() Jiri Pirko
2023-01-26  7:58 ` [patch net-next v2 05/12] ice: remove pointless calls to devlink_param_driverinit_value_set() Jiri Pirko
2023-01-26  7:58 ` [patch net-next v2 06/12] qed: remove pointless call " Jiri Pirko
2023-01-26  7:58 ` Jiri Pirko [this message]
2023-01-26  7:58 ` [patch net-next v2 08/12] devlink: put couple of WARN_ONs in devlink_param_driverinit_value_get() Jiri Pirko
2023-01-26  7:58 ` [patch net-next v2 09/12] devlink: protect devlink param list by instance lock Jiri Pirko
2023-01-26  9:28   ` Ido Schimmel
2023-01-27 11:32   ` Simon Horman
2023-01-27 11:41     ` Simon Horman
2023-01-26  7:58 ` [patch net-next v2 10/12] net/mlx5: Move fw reset devlink param to fw reset code Jiri Pirko
2023-01-26  7:58 ` [patch net-next v2 11/12] net/mlx5: Move flow steering devlink param to flow steering code Jiri Pirko
2023-01-26  7:58 ` [patch net-next v2 12/12] net/mlx5: Move eswitch port metadata devlink param to flow eswitch code Jiri Pirko
2023-01-27 12:50 ` [patch net-next v2 00/12] devlink: Cleanup params usage patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230126075838.1643665-8-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=Niklas.Cassel@wdc.com \
    --cc=aelior@marvell.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fei.qin@corigine.com \
    --cc=gal@nvidia.com \
    --cc=idosch@nvidia.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=manishc@marvell.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=simon.horman@corigine.com \
    --cc=tariqt@nvidia.com \
    --cc=yinjun.zhang@corigine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox