linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] max732x_probe: remove redundant check
@ 2020-06-10 11:36 Gaurav Singh
  2020-06-20 20:16 ` Linus Walleij
  2020-06-20 22:40 ` Gaurav Singh
  0 siblings, 2 replies; 6+ messages in thread
From: Gaurav Singh @ 2020-06-10 11:36 UTC (permalink / raw)
  To: gaurav1086, Linus Walleij, Bartosz Golaszewski,
	open list:GPIO SUBSYSTEM, open list

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>

The pdata is already checked for its validity. Remove
this redundant check.

---
 drivers/gpio/gpio-max732x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 5fb0bcf31142..63472f308857 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -703,7 +703,7 @@ static int max732x_probe(struct i2c_client *client,
 	if (ret)
 		return ret;
 
-	if (pdata && pdata->setup) {
+	if (pdata->setup) {
 		ret = pdata->setup(client, chip->gpio_chip.base,
 				chip->gpio_chip.ngpio, pdata->context);
 		if (ret < 0)
-- 
2.17.1


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

* Re: [PATCH] max732x_probe: remove redundant check
  2020-06-10 11:36 [PATCH] max732x_probe: remove redundant check Gaurav Singh
@ 2020-06-20 20:16 ` Linus Walleij
  2020-06-20 22:40 ` Gaurav Singh
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2020-06-20 20:16 UTC (permalink / raw)
  To: Gaurav Singh; +Cc: Bartosz Golaszewski, open list:GPIO SUBSYSTEM, open list

On Wed, Jun 10, 2020 at 1:36 PM Gaurav Singh <gaurav1086@gmail.com> wrote:

> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
>
> The pdata is already checked for its validity. Remove
> this redundant check.

Patch applied.

Please put signed-off-by at the end of the mail.

Yours,
Linus Walleij

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

* [PATCH] max732x_probe: remove redundant check
  2020-06-10 11:36 [PATCH] max732x_probe: remove redundant check Gaurav Singh
  2020-06-20 20:16 ` Linus Walleij
@ 2020-06-20 22:40 ` Gaurav Singh
  1 sibling, 0 replies; 6+ messages in thread
From: Gaurav Singh @ 2020-06-20 22:40 UTC (permalink / raw)
  To: gaurav1086, Linus Walleij, Bartosz Golaszewski,
	open list:GPIO SUBSYSTEM, open list

The pdata is already checked for its validity.
Remove the redundant check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 drivers/gpio/gpio-max732x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 5fb0bcf31142..63472f308857 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -703,7 +703,7 @@ static int max732x_probe(struct i2c_client *client,
 	if (ret)
 		return ret;
 
-	if (pdata && pdata->setup) {
+	if (pdata->setup) {
 		ret = pdata->setup(client, chip->gpio_chip.base,
 				chip->gpio_chip.ngpio, pdata->context);
 		if (ret < 0)
-- 
2.17.1


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

* Re: [PATCH] max732x_probe: remove redundant check
  2020-06-17 23:58 Gaurav Singh
@ 2020-06-22 16:50 ` Bartosz Golaszewski
  0 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2020-06-22 16:50 UTC (permalink / raw)
  To: Gaurav Singh; +Cc: Linus Walleij, open list:GPIO SUBSYSTEM, open list

czw., 18 cze 2020 o 01:58 Gaurav Singh <gaurav1086@gmail.com> napisał(a):
>
> The check : if (pdata) is redundant since its already
> dereferenced before: pdata->have_64bit_regs;
> pdata is not initialized after that hence remove
> this null check.
>
> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
> ---
>  drivers/gpio/gpio-max732x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
> index 5fb0bcf31142..63472f308857 100644
> --- a/drivers/gpio/gpio-max732x.c
> +++ b/drivers/gpio/gpio-max732x.c
> @@ -703,7 +703,7 @@ static int max732x_probe(struct i2c_client *client,
>         if (ret)
>                 return ret;
>
> -       if (pdata && pdata->setup) {
> +       if (pdata->setup) {
>                 ret = pdata->setup(client, chip->gpio_chip.base,
>                                 chip->gpio_chip.ngpio, pdata->context);
>                 if (ret < 0)
> --
> 2.17.1
>

The subject should be 'gpio: max732x: ...". I fixed it up and applied
the path to for-next.

Bartosz

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

* [PATCH] max732x_probe: remove redundant check
@ 2020-06-17 23:58 Gaurav Singh
  2020-06-22 16:50 ` Bartosz Golaszewski
  0 siblings, 1 reply; 6+ messages in thread
From: Gaurav Singh @ 2020-06-17 23:58 UTC (permalink / raw)
  To: gaurav1086, Linus Walleij, Bartosz Golaszewski,
	open list:GPIO SUBSYSTEM, open list

The check : if (pdata) is redundant since its already
dereferenced before: pdata->have_64bit_regs;
pdata is not initialized after that hence remove 
this null check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 drivers/gpio/gpio-max732x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 5fb0bcf31142..63472f308857 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -703,7 +703,7 @@ static int max732x_probe(struct i2c_client *client,
 	if (ret)
 		return ret;
 
-	if (pdata && pdata->setup) {
+	if (pdata->setup) {
 		ret = pdata->setup(client, chip->gpio_chip.base,
 				chip->gpio_chip.ngpio, pdata->context);
 		if (ret < 0)
-- 
2.17.1


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

* Re: [PATCH] max732x_probe: remove redundant check
       [not found] <CAFAFadBs5UNsktWR072dXwvJpk-rk1wqPBCb=gkLfxMbE55QUQ@mail.gmail.com>
@ 2020-06-10 10:02 ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2020-06-10 10:02 UTC (permalink / raw)
  To: gaurav singh; +Cc: Bartosz Golaszewski, open list:GPIO SUBSYSTEM, linux-kernel

On Sat, Jun 6, 2020 at 5:09 PM gaurav singh <gaurav1086@gmail.com> wrote:

> The pdata is already checked for its validity above:
>
>     if (!pdata) {
>         dev_dbg(&client->dev, "no platform data\n");
>         return -EINVAL;
>     }
>
> So no need to check again. Hence remove the if (pdata) part. Please find the patch below.

Please send the patch as a single main using git send-email.

For further help see:
Documentation/process/email-clients.rst

Yours,
Linus Walleij

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

end of thread, other threads:[~2020-06-22 16:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 11:36 [PATCH] max732x_probe: remove redundant check Gaurav Singh
2020-06-20 20:16 ` Linus Walleij
2020-06-20 22:40 ` Gaurav Singh
  -- strict thread matches above, loose matches on Subject: below --
2020-06-17 23:58 Gaurav Singh
2020-06-22 16:50 ` Bartosz Golaszewski
     [not found] <CAFAFadBs5UNsktWR072dXwvJpk-rk1wqPBCb=gkLfxMbE55QUQ@mail.gmail.com>
2020-06-10 10:02 ` Linus Walleij

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).