From: Martiros Shakhzadyan <vrzh@vrzh.net>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Martiros Shakhzadyan <vrzh@vrzh.net>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-media@vger.kernel.org
Subject: [PATCH] staging: media: atomisp: Use goto instead of return in ia_css_init()
Date: Wed, 14 Apr 2021 20:51:04 -0400 [thread overview]
Message-ID: <20210415005106.530914-8-vrzh@vrzh.net> (raw)
In-Reply-To: <20210415005106.530914-1-vrzh@vrzh.net>
Replace multiple return statements with goto in ia_css_init(), matching
other functions.
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
---
drivers/staging/media/atomisp/pci/sh_css.c | 45 +++++++++-------------
1 file changed, 19 insertions(+), 26 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c
index bb752d47457c..4e3ef68014ec 100644
--- a/drivers/staging/media/atomisp/pci/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/sh_css.c
@@ -1695,10 +1695,8 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,
my_css.flush = flush_func;
err = ia_css_rmgr_init();
- if (err) {
- IA_CSS_LEAVE_ERR(err);
- return err;
- }
+ if (err)
+ goto ERR;
IA_CSS_LOG("init: %d", my_css_save_initialized);
@@ -1730,27 +1728,23 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,
gpio_reg_store(GPIO0_ID, _gpio_block_reg_do_0, 0);
err = ia_css_refcount_init(REFCOUNT_SIZE);
- if (err) {
- IA_CSS_LEAVE_ERR(err);
- return err;
- }
+ if (err)
+ goto ERR;
+
err = sh_css_params_init();
- if (err) {
- IA_CSS_LEAVE_ERR(err);
- return err;
- }
+ if (err)
+ goto ERR;
+
if (fw) {
ia_css_unload_firmware(); /* in case we already had firmware loaded */
err = sh_css_load_firmware(dev, fw->data, fw->bytes);
- if (err) {
- IA_CSS_LEAVE_ERR(err);
- return err;
- }
+ if (err)
+ goto ERR;
+
err = ia_css_binary_init_infos();
- if (err) {
- IA_CSS_LEAVE_ERR(err);
- return err;
- }
+ if (err)
+ goto ERR;
+
fw_explicitly_loaded = false;
#ifndef ISP2401
my_css_save.loaded_fw = (struct ia_css_fw *)fw;
@@ -1760,10 +1754,8 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,
return -EINVAL;
err = ia_css_spctrl_load_fw(SP0_ID, &spctrl_cfg);
- if (err) {
- IA_CSS_LEAVE_ERR(err);
- return err;
- }
+ if (err)
+ goto ERR;
#if WITH_PC_MONITORING
if (!thread_alive) {
@@ -1774,8 +1766,8 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,
}
#endif
if (!sh_css_hrt_system_is_idle()) {
- IA_CSS_LEAVE_ERR(-EBUSY);
- return -EBUSY;
+ err = -EBUSY;
+ goto ERR;
}
/* can be called here, queuing works, but:
- when sp is started later, it will wipe queued items
@@ -1801,6 +1793,7 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,
sh_css_params_map_and_store_default_gdc_lut();
+ERR:
IA_CSS_LEAVE_ERR(err);
return err;
}
--
2.31.1
next prev parent reply other threads:[~2021-04-15 0:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-15 0:50 [PATCH] staging: media: atomisp: cleaning up sh_css.c Martiros Shakhzadyan
2021-04-15 0:50 ` [PATCH] staging: media: atomisp: [1/6] Fix sh_css.c brace coding style issues Martiros Shakhzadyan
2021-04-15 0:50 ` [PATCH] staging: media: atomisp: [2/6] " Martiros Shakhzadyan
2021-04-15 0:51 ` [PATCH] staging: media: atomisp: [3/6] " Martiros Shakhzadyan
2021-04-15 0:51 ` [PATCH] staging: media: atomisp: [4/6] " Martiros Shakhzadyan
2021-04-15 0:51 ` [PATCH] staging: media: atomisp: [5/6] " Martiros Shakhzadyan
2021-04-15 0:51 ` [PATCH] staging: media: atomisp: [6/6] " Martiros Shakhzadyan
2021-04-15 0:51 ` Martiros Shakhzadyan [this message]
2021-04-15 13:56 ` [PATCH] staging: media: atomisp: Use goto instead of return in ia_css_init() Hans Verkuil
2021-04-15 16:39 ` Martiros Shakhzadyan
2021-04-15 0:51 ` [PATCH] staging: media: atomisp: [1/2] Remove redundant assertions in sh_css.c Martiros Shakhzadyan
2021-04-15 13:46 ` Hans Verkuil
2021-04-15 0:51 ` [PATCH] staging: media: atomisp: [2/2] " Martiros Shakhzadyan
2021-04-15 13:59 ` [PATCH] staging: media: atomisp: cleaning up sh_css.c Hans Verkuil
2021-04-15 16:29 ` Martiros Shakhzadyan
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=20210415005106.530914-8-vrzh@vrzh.net \
--to=vrzh@vrzh.net \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.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