public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 5/8] I2C: ali15x3: Do PCI error checks on own line
       [not found] <20230827133705.12991-1-ilpo.jarvinen@linux.intel.com>
@ 2023-08-27 13:37 ` Ilpo Järvinen
  2023-08-28 22:10   ` Andi Shyti
  2023-08-30 19:18   ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2023-08-27 13:37 UTC (permalink / raw)
  To: linux-pci, Bjorn Helgaas, Andi Shyti, Philippe Mathieu-Daudé,
	Jean Delvare, linux-i2c, linux-kernel
  Cc: Ilpo Järvinen

Instead of if conditions with line splits, use the usual error handling
pattern with a separate variable to improve readability.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/i2c/busses/i2c-ali15x3.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index cc58feacd082..0231c5be6354 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -165,14 +165,15 @@ static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
 	}
 
 	if(force_addr) {
+		int ret;
+
 		dev_info(&ALI15X3_dev->dev, "forcing ISA address 0x%04X\n",
 			ali15x3_smba);
-		if (PCIBIOS_SUCCESSFUL != pci_write_config_word(ALI15X3_dev,
-								SMBBA,
-								ali15x3_smba))
+		ret = pci_write_config_word(ALI15X3_dev, SMBBA, ali15x3_smba);
+		if (ret != PCIBIOS_SUCCESSFUL)
 			goto error;
-		if (PCIBIOS_SUCCESSFUL != pci_read_config_word(ALI15X3_dev,
-								SMBBA, &a))
+		ret = pci_read_config_word(ALI15X3_dev, SMBBA, &a);
+		if (ret != PCIBIOS_SUCCESSFUL)
 			goto error;
 		if ((a & ~(ALI15X3_SMB_IOSIZE - 1)) != ali15x3_smba) {
 			/* make sure it works */
-- 
2.30.2


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

* Re: [PATCH v2 5/8] I2C: ali15x3: Do PCI error checks on own line
  2023-08-27 13:37 ` [PATCH v2 5/8] I2C: ali15x3: Do PCI error checks on own line Ilpo Järvinen
@ 2023-08-28 22:10   ` Andi Shyti
  2023-08-30 19:18   ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Andi Shyti @ 2023-08-28 22:10 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: linux-pci, Bjorn Helgaas, Philippe Mathieu-Daudé,
	Jean Delvare, linux-i2c, linux-kernel

Hi Ilpo,

On Sun, Aug 27, 2023 at 04:37:02PM +0300, Ilpo Järvinen wrote:
> Instead of if conditions with line splits, use the usual error handling
> pattern with a separate variable to improve readability.
> 
> No functional changes intended.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi

> ---
>  drivers/i2c/busses/i2c-ali15x3.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
> index cc58feacd082..0231c5be6354 100644
> --- a/drivers/i2c/busses/i2c-ali15x3.c
> +++ b/drivers/i2c/busses/i2c-ali15x3.c
> @@ -165,14 +165,15 @@ static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
>  	}
>  
>  	if(force_addr) {
> +		int ret;
> +
>  		dev_info(&ALI15X3_dev->dev, "forcing ISA address 0x%04X\n",
>  			ali15x3_smba);
> -		if (PCIBIOS_SUCCESSFUL != pci_write_config_word(ALI15X3_dev,
> -								SMBBA,
> -								ali15x3_smba))
> +		ret = pci_write_config_word(ALI15X3_dev, SMBBA, ali15x3_smba);
> +		if (ret != PCIBIOS_SUCCESSFUL)
>  			goto error;
> -		if (PCIBIOS_SUCCESSFUL != pci_read_config_word(ALI15X3_dev,
> -								SMBBA, &a))
> +		ret = pci_read_config_word(ALI15X3_dev, SMBBA, &a);
> +		if (ret != PCIBIOS_SUCCESSFUL)
>  			goto error;
>  		if ((a & ~(ALI15X3_SMB_IOSIZE - 1)) != ali15x3_smba) {
>  			/* make sure it works */
> -- 
> 2.30.2
> 

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

* Re: [PATCH v2 5/8] I2C: ali15x3: Do PCI error checks on own line
  2023-08-27 13:37 ` [PATCH v2 5/8] I2C: ali15x3: Do PCI error checks on own line Ilpo Järvinen
  2023-08-28 22:10   ` Andi Shyti
@ 2023-08-30 19:18   ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2023-08-30 19:18 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: linux-pci, Bjorn Helgaas, Andi Shyti, Philippe Mathieu-Daudé,
	Jean Delvare, linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

On Sun, Aug 27, 2023 at 04:37:02PM +0300, Ilpo Järvinen wrote:
> Instead of if conditions with line splits, use the usual error handling
> pattern with a separate variable to improve readability.
> 
> No functional changes intended.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2023-08-30 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230827133705.12991-1-ilpo.jarvinen@linux.intel.com>
2023-08-27 13:37 ` [PATCH v2 5/8] I2C: ali15x3: Do PCI error checks on own line Ilpo Järvinen
2023-08-28 22:10   ` Andi Shyti
2023-08-30 19:18   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox