lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170403102904.xjfq6km6qh43yblh@dell>
Date:   Mon, 3 Apr 2017 11:29:04 +0100
From:   Lee Jones <lee.jones@...aro.org>
To:     sathyanarayanan.kuppuswamy@...ux.intel.com
Cc:     sathyaosid@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/1] mfd: bxtwc: remove unnecessary i2c_addr checks in
 ipc calls

On Thu, 30 Mar 2017, sathyanarayanan.kuppuswamy@...ux.intel.com wrote:

> From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
> 
> In the following code block, BXTWC_DEVICE1_ADDR value is
> already fixed and hence there no need to check for
> if (!i2c_addr) in every ipc read/write calls. Even if this
> check is required it can be moved to probe function.
> 
> i2c_addr = BXTWC_DEVICE1_ADDR;
> if (!i2c_addr) {
> 	dev_err(pmic->dev, "I2C address not set\n");
> 	return -EINVAL;
> }
> 
> This patch remove this extra check and adds some NULL
> parameter checks.
> 
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
> ---
>  drivers/mfd/intel_soc_pmic_bxtwc.c | 22 ++++++++++------------
>  1 file changed, 10 insertions(+), 12 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
> index 699c8c7..583d17d 100644
> --- a/drivers/mfd/intel_soc_pmic_bxtwc.c
> +++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
> @@ -237,15 +237,14 @@ static int regmap_ipc_byte_reg_read(void *context, unsigned int reg,
>  	u8 ipc_out[4];
>  	struct intel_soc_pmic *pmic = context;
>  
> +	if (!pmic)
> +		return -EINVAL;
> +
>  	if (reg & REG_ADDR_MASK)
>  		i2c_addr = (reg & REG_ADDR_MASK) >> REG_ADDR_SHIFT;
> -	else {
> +	else
>  		i2c_addr = BXTWC_DEVICE1_ADDR;
> -		if (!i2c_addr) {
> -			dev_err(pmic->dev, "I2C address not set\n");
> -			return -EINVAL;
> -		}
> -	}
> +
>  	reg &= REG_OFFSET_MASK;
>  
>  	ipc_in[0] = reg;
> @@ -270,15 +269,14 @@ static int regmap_ipc_byte_reg_write(void *context, unsigned int reg,
>  	u8 ipc_in[3];
>  	struct intel_soc_pmic *pmic = context;
>  
> +	if (!pmic)
> +		return -EINVAL;
> +
>  	if (reg & REG_ADDR_MASK)
>  		i2c_addr = (reg & REG_ADDR_MASK) >> REG_ADDR_SHIFT;
> -	else {
> +	else
>  		i2c_addr = BXTWC_DEVICE1_ADDR;
> -		if (!i2c_addr) {
> -			dev_err(pmic->dev, "I2C address not set\n");
> -			return -EINVAL;
> -		}
> -	}
> +
>  	reg &= REG_OFFSET_MASK;
>  
>  	ipc_in[0] = reg;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ