linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] drivers/pinconf.c: Remove redundant check for the existence of the member
@ 2023-05-14 16:59 Lizhe
  2023-05-14 21:10 ` andy.shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Lizhe @ 2023-05-14 16:59 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, Lizhe

"pin_config_set" in pinconf_ops.

In the function of registering pinctrl_dev, pinctrl_init_controller(),
a non-null check has already been performed on the members
pin_config_set and pin_config_group_set in the ops structure.

Signed-off-by: Lizhe <sensor1010@163.com>
---
 drivers/pinctrl/pinconf.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index d9d54065472e..7b078d4ab61e 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -158,10 +158,6 @@ int pinconf_apply_setting(const struct pinctrl_setting *setting)
 
 	switch (setting->type) {
 	case PIN_MAP_TYPE_CONFIGS_PIN:
-		if (!ops->pin_config_set) {
-			dev_err(pctldev->dev, "missing pin_config_set op\n");
-			return -EINVAL;
-		}
 		ret = ops->pin_config_set(pctldev,
 				setting->data.configs.group_or_pin,
 				setting->data.configs.configs,
@@ -174,11 +170,6 @@ int pinconf_apply_setting(const struct pinctrl_setting *setting)
 		}
 		break;
 	case PIN_MAP_TYPE_CONFIGS_GROUP:
-		if (!ops->pin_config_group_set) {
-			dev_err(pctldev->dev,
-				"missing pin_config_group_set op\n");
-			return -EINVAL;
-		}
 		ret = ops->pin_config_group_set(pctldev,
 				setting->data.configs.group_or_pin,
 				setting->data.configs.configs,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] drivers/pinconf.c: Remove redundant check for the existence of the member
  2023-05-14 16:59 [PATCH v1] drivers/pinconf.c: Remove redundant check for the existence of the member Lizhe
@ 2023-05-14 21:10 ` andy.shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: andy.shevchenko @ 2023-05-14 21:10 UTC (permalink / raw)
  To: Lizhe; +Cc: linus.walleij, linux-gpio, linux-kernel

Mon, May 15, 2023 at 12:59:32AM +0800, Lizhe kirjoitti:
> "pin_config_set" in pinconf_ops.
> 
> In the function of registering pinctrl_dev, pinctrl_init_controller(),
> a non-null check has already been performed on the members
> pin_config_set and pin_config_group_set in the ops structure.

NAK.

Try to analyse what `if (!foo && !bar)` means from the logic perspective and
deduce from that the problem in your proposal.

P.S. It's not the first wrong proposed change from you. Dunno if you even
trying to read the code...

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-14 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-14 16:59 [PATCH v1] drivers/pinconf.c: Remove redundant check for the existence of the member Lizhe
2023-05-14 21:10 ` andy.shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).