From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] video: atmel_lcdfb: Use common error handling code in atmel_lcdfb_of_init()
Date: Sun, 05 Nov 2017 13:10:29 +0000 [thread overview]
Message-ID: <2db677d2-ad4e-1f79-344b-dfa38ce948c9@users.sourceforge.net> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 5 Nov 2017 14:00:52 +0100
Add a jump target so that a specific error message is stored only once
at the end of this function implementation.
Replace two calls of the function "dev_err" by goto statements.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/atmel_lcdfb.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index e06358da4b99..3672c2e52ebd 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -1047,10 +1047,8 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
}
ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel);
- if (ret < 0) {
- dev_err(dev, "failed to get property bits-per-pixel\n");
- goto put_display_node;
- }
+ if (ret < 0)
+ goto report_bits_failure;
ret = of_property_read_u32(display_np, "atmel,guard-time", &pdata->guard_time);
if (ret < 0) {
@@ -1065,10 +1063,8 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
}
ret = of_property_read_u32(display_np, "atmel,dmacon", &pdata->default_dmacon);
- if (ret < 0) {
- dev_err(dev, "failed to get property bits-per-pixel\n");
- goto put_display_node;
- }
+ if (ret < 0)
+ goto report_bits_failure;
INIT_LIST_HEAD(&pdata->pwr_gpios);
ret = -ENOMEM;
@@ -1147,6 +1143,10 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
put_display_node:
of_node_put(display_np);
return ret;
+
+report_bits_failure:
+ dev_err(dev, "failed to get property bits-per-pixel\n");
+ goto put_display_node;
}
#else
static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
--
2.15.0
next reply other threads:[~2017-11-05 13:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-05 13:10 SF Markus Elfring [this message]
2017-11-06 8:40 ` [PATCH] video: atmel_lcdfb: Use common error handling code in atmel_lcdfb_of_init() Nicolas Ferre
2017-11-06 8:53 ` Dan Carpenter
2017-11-06 9:00 ` SF Markus Elfring
2017-11-06 9:53 ` Dan Carpenter
2017-11-06 9:32 ` SF Markus Elfring
2017-11-06 10:06 ` Nicolas Ferre
2017-11-06 18:14 ` [PATCH v2] video: atmel_lcdfb: Use unique error messages " SF Markus Elfring
2017-11-06 18:32 ` Joe Perches
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=2db677d2-ad4e-1f79-344b-dfa38ce948c9@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=b.zolnierkie@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.ferre@microchip.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;
as well as URLs for NNTP newsgroup(s).