mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/3] video/ssd1307fb: drop unneeded regulator NULL checks
Date: Mon,  2 Mar 2020 12:49:54 +0100	[thread overview]
Message-ID: <20200302114955.13897-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20200302114955.13897-1-a.fatoum@pengutronix.de>

regulator_{enable,disable} are already no-ops when the parameter is
NULL. Drop the NULL checks thusly.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/video/ssd1307fb.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
index 83a561a3e1fc..cc50698670e0 100644
--- a/drivers/video/ssd1307fb.c
+++ b/drivers/video/ssd1307fb.c
@@ -513,11 +513,9 @@ static int ssd1307fb_probe(struct device_d *dev)
 		goto reset_oled_error;
 	}
 
-	if (par->vbat) {
-		ret = regulator_disable(par->vbat);
-		if (ret < 0)
-			goto reset_oled_error;
-	}
+	ret = regulator_disable(par->vbat);
+	if (ret < 0)
+		goto reset_oled_error;
 
 	i2c_set_clientdata(client, info);
 
@@ -525,11 +523,9 @@ static int ssd1307fb_probe(struct device_d *dev)
 	gpio_set_value(par->reset, 0);
 	udelay(4);
 
-	if (par->vbat) {
-		ret = regulator_enable(par->vbat);
-		if (ret < 0)
-			goto reset_oled_error;
-	}
+	ret = regulator_enable(par->vbat);
+	if (ret < 0)
+		goto reset_oled_error;
 
 	mdelay(100);
 
-- 
2.25.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-03-02 11:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02 11:49 [PATCH 1/3] video/ssd1307fb: fix NULL pointer dereference in probe Ahmad Fatoum
2020-03-02 11:49 ` Ahmad Fatoum [this message]
2020-03-02 11:49 ` [PATCH 3/3] video/ssd1307fb: make reset GPIO optional Ahmad Fatoum
2020-03-09  7:31 ` [PATCH 1/3] video/ssd1307fb: fix NULL pointer dereference in probe Sascha Hauer

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=20200302114955.13897-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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