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] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5htupcrhc3.wl-tiwai@suse.de>
Date:   Mon, 15 Mar 2021 08:45:00 +0100
From:   Takashi Iwai <tiwai@...e.de>
To:     Vitaly Rodionov <vitalyr@...nsource.cirrus.com>
Cc:     Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
        <alsa-devel@...a-project.org>, <patches@...nsource.cirrus.com>,
        <linux-kernel@...r.kernel.org>,
        Stefan Binding <sbinding@...nsource.cirrus.com>
Subject: Re: [PATCH v1 1/4] ALSA: hda/cirrus: Add error handling into CS8409 I2C functions

On Sat, 13 Mar 2021 12:34:07 +0100,
Vitaly Rodionov wrote:
> 
> @@ -1508,7 +1508,7 @@ static void cs8409_enable_i2c_clock(struct hda_codec *codec, unsigned int flag)
>  static int cs8409_i2c_wait_complete(struct hda_codec *codec)
>  {
>  	int repeat = 5;
> -	unsigned int retval = 0;
> +	unsigned int retval;
>  
>  	do {
>  		retval = cs_vendor_coef_get(codec, CIR_I2C_STATUS);
> @@ -1520,78 +1520,82 @@ static int cs8409_i2c_wait_complete(struct hda_codec *codec)
>  
>  	} while (repeat);
>  
> -	return repeat > 0 ? 0 : -1;
> +	return !!repeat;
>  }

If the return value of the function has changed, it's nicer to
comment, e.g. a brief function description would be helpful.
Also now this looks rather like a bool?


> @@ -1881,13 +1896,15 @@ static void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res)
>  	reg_hs_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1124, 1);
>  	reg_ts_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1);
>  
> -	/* Clear interrupts */
> +	/* Clear interrupts, by reading interrupt status registers */
>  	cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1b7b, 1);
> -	cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1);
> -	cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1);

Why those two calls are removed?

>  	mutex_unlock(&spec->cs8409_i2c_mux);
>  
> +	/* If status values are < 0, read error has occurred. */
> +	if ((reg_cdc_status < 0) || (reg_hs_status < 0) || (reg_ts_status < 0))
> +		return;

Parentheses around the comparison are superfluous, you can remove
them.


thanks,

Takashi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ