I noticed this code in the function tegra_i2c_probe() :
static int tegra_i2c_probe(struct platform_device *pdev)
{
struct tegra_i2c_dev *i2c_dev;
struct resource *res;
int err;
i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL);
......
if ((i2c_dev->bus_clk_rate == I2C_HS_MODE) &&
!i2c_dev->hw->has_hs_mode_support) {
dev_info(i2c_dev->dev, "HS mode not supported\n");
i2c_dev->bus_clk_rate = 100000; /* default clock rate */
}
......
tegra_i2c_parse_dt(i2c_dev);
......
}
The point is that i2c_dev->bus_clk_rate is tested and perhaps will be adjusted in the ‘if’ statement above. However, the first place that i2c_dev->bus_clk_rate is initialized is from tegra_i2c_parse_dt(i2c_dev) where it gets its first value through:
of_property_read_u32(np, “clock-frequency”, &i2c_dev->bus_clk_rate)
So I can see, i2c_dev->bus_clk_rate is used before it is initialized.
Bug?