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: <b72f8946-f921-f098-de36-e7f6203d6391@gmail.com>
Date:   Thu, 7 Feb 2019 23:22:48 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     Sowjanya Komatineni <skomatineni@...dia.com>,
        thierry.reding@...il.com, jonathanh@...dia.com,
        mkarthik@...dia.com, smohammed@...dia.com, talho@...dia.com
Cc:     linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-i2c@...r.kernel.org
Subject: Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

07.02.2019 22:14, Dmitry Osipenko пишет:
> 06.02.2019 22:16, Sowjanya Komatineni пишет:
>> +static void tegra_i2c_config_fifo_trig(struct tegra_i2c_dev *i2c_dev,
>> +				       size_t len)
>> +{
>> +	u32 val = 0, reg;
>> +	u8 dma_burst = 0;

There is no need to set dma_burst to zero as well. In general you only need to initialize variables if code uses the uninitialized variable.

>> +	struct dma_slave_config slv_config = {0};
>> +	struct dma_chan *chan;
>> +	int ret;
>> +	unsigned long reg_offset;
>> +
>> +	if (i2c_dev->hw->has_mst_fifo)
>> +		reg = I2C_MST_FIFO_CONTROL;
>> +	else
>> +		reg = I2C_FIFO_CONTROL;
>> +
>> +	if (i2c_dev->is_curr_dma_xfer) {
>> +		if (len & 0xF)
>> +			dma_burst = 1;
>> +		else if (len & 0x10)
>> +			dma_burst = 4;
>> +		else
>> +			dma_burst = 8;

In this case compiler just ignores the first initialization because it is explicitly initialized later on in the code path that actually uses the dma_burst variable. Avoiding unnecessary initialization helps to keep code a bit more clean.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ