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: <20120813064012.GC4559@mwanda>
Date:	Mon, 13 Aug 2012 09:40:13 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	wei_wang@...lsil.com.cn
Cc:	gregkh@...uxfoundation.org, devel@...uxdriverproject.org,
	linux-kernel@...r.kernel.org, linux-mmc@...r.kernel.org,
	cjb@...top.org, arnd@...db.de, sameo@...ux.intel.com,
	aaron.lu@....com, bp@...en8.de
Subject: Re: [PATCH 1/2] drivers/mfd: Add realtek pcie card reader driver

On Mon, Aug 13, 2012 at 10:06:26AM +0800, wei_wang@...lsil.com.cn wrote:
> +int rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val)
> +{
> +	int err, i, finished = 0;
> +	u16 data = 0;
> +	u8 *ptr, tmp;
> +
> +	rtsx_pci_init_cmd(pcr);
> +
> +	rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PHYADDR, 0xFF, addr);
> +	rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PHYRWCTL, 0xFF, 0x80);
> +
> +	err = rtsx_pci_send_cmd(pcr, 100);
> +	if (err < 0)
> +		return err;
> +
> +	for (i = 0; i < 100000; i++) {
> +		err = rtsx_pci_read_register(pcr, PHYRWCTL, &tmp);
> +		if (err < 0)
> +			return err;
> +
> +		if (!(tmp & 0x80)) {
> +			finished = 1;
> +			break;
> +		}
> +	}
> +
> +	if (!finished)
> +		return -ETIMEDOUT;
> +
> +	rtsx_pci_init_cmd(pcr);
> +
> +	rtsx_pci_add_cmd(pcr, READ_REG_CMD, PHYDATA0, 0, 0);
> +	rtsx_pci_add_cmd(pcr, READ_REG_CMD, PHYDATA1, 0, 0);
> +
> +	err = rtsx_pci_send_cmd(pcr, 100);
> +	if (err < 0)
> +		return err;
> +
> +	ptr = rtsx_pci_get_cmd_data(pcr);
> +	data = ((u16)ptr[1] << 8) || ptr[0];
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Looks like bitwise OR was intended here.

> +
> +	if (val)
> +		*val = data;
> +
> +	return 0;
> +}

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ