Skip to contentSkip to conversation

intel_soc_pmic_mrfld: simplify the return expression of intel_scu_ipc_dev_iowrite8()

PATCH Applied Xu Wang 4 participants 5 messages Jul 27, 2020

Subsystems (3)
lore
Share & tools
lore

Xu Wang

author
#0 lore raw

PATCH 1/1 intel_soc_pmic_mrfld: simplify the return expression of intel_scu_ipc_dev_iowrite8()

Simplify the return expression.

---
 drivers/mfd/intel_soc_pmic_mrfld.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/mfd/intel_soc_pmic_mrfld.c +1 -6
index bd94c989d232..71da861e8c27 100644
@@ -91,13 +91,8 @@ static int bcove_ipc_byte_reg_write(void *context, unsigned int reg,
 {
 	struct intel_soc_pmic *pmic = context;
 	u8 ipc_in = val;
-	int ret;
 
-	ret = intel_scu_ipc_dev_iowrite8(pmic->scu, reg, ipc_in);
-	if (ret)
-		return ret;
-
-	return 0;
+	return intel_scu_ipc_dev_iowrite8(pmic->scu, reg, ipc_in);
 }
 
 static const struct regmap_config bcove_regmap_config = {
Signature · 1 line
2.17.1
#1 lore raw
Quoted 1 line · Xu Wang

Simplify the return expression.

I understand your intention, but I would rather leave as is. It's a bit more helpful in the original form in case to add some debugging. It also keep it symmetrical with read() counterpart.

That said, I'm not objecting the change if Lee finds it good enough.

Quoted 27 lines
---
 drivers/mfd/intel_soc_pmic_mrfld.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/mfd/intel_soc_pmic_mrfld.c +1 -6
index bd94c989d232..71da861e8c27 100644
@@ -91,13 +91,8 @@ static int bcove_ipc_byte_reg_write(void *context, unsigned int reg,
 {
 	struct intel_soc_pmic *pmic = context;
 	u8 ipc_in = val;
-	int ret;
 
-	ret = intel_scu_ipc_dev_iowrite8(pmic->scu, reg, ipc_in);
-	if (ret)
-		return ret;
-
-	return 0;
+	return intel_scu_ipc_dev_iowrite8(pmic->scu, reg, ipc_in);
 }
 
 static const struct regmap_config bcove_regmap_config = {
Signature · 1 line
2.17.1
Signature · 2 lines
With Best Regards,
Andy Shevchenko
Applied
#2 lore raw
Quoted 5 lines · Andy Shevchenko
Quoted 1 line · Xu Wang

Simplify the return expression.

I understand your intention, but I would rather leave as is. It's a bit more helpful in the original form in case to add some debugging.

If you wish to add debugging, you'll have to add the extra line of code yourself. :)

Quoted 1 line

It also keep it symmetrical with read() counterpart.

Can this be fixed-up too?

Quoted 6 lines

That said, I'm not objecting the change if Lee finds it good enough.

Quoted 4 lines
---
 drivers/mfd/intel_soc_pmic_mrfld.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw
Quoted 2 lines · Lee Jones
Quoted 1 line · Andy Shevchenko

On Mon, Jul 27, 2020 at 03:04:07AM +0000, Xu Wang wrote:

...

Quoted 4 lines
Quoted 1 line

It's a bit more helpful in the original form in case to add some debugging.

If you wish to add debugging, you'll have to add the extra line of code yourself. :)

True, that's why I'm not objecting the change.

Quoted 3 lines
Quoted 1 line

It also keep it symmetrical with read() counterpart.

Can this be fixed-up too?

How? Can you elaborate?

Quoted 1 line
Quoted 1 line

That said, I'm not objecting the change if Lee finds it good enough.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 2 lines · Lee Jones
Quoted 1 line · Andy Shevchenko

On Mon, Jul 27, 2020 at 03:04:07AM +0000, Xu Wang wrote:

...

Quoted 4 lines
Quoted 1 line

It's a bit more helpful in the original form in case to add some debugging.

If you wish to add debugging, you'll have to add the extra line of code yourself. :)

Quoted 7 lines

True, that's why I'm not objecting the change.

Quoted 3 lines
Quoted 1 line

It also keep it symmetrical with read() counterpart.

Can this be fixed-up too?

How? Can you elaborate?

I hadn't even looked at the code before my reply. I just assumed it was in a similar situation.

Now I have looked at it, could the pointer to the return value be cast?

If not, just leave it. Symmetry isn't a good measure of good, clean code.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog