[PATCH 1/2] i2c: designware_i2c: Tidy up use of NULL priv

Heiko Schocher hs at denx.de
Sat May 30 05:47:10 CEST 2020


Hello Simon,

Am 22.04.2020 um 18:13 schrieb Simon Glass:
> At present we still have pre-driver-model code in this driver and it makes
> things a bit confusing. In particular calc_bus_speed() is called with priv
> as NULL if not using driver model.
> 
> This results in spk_cnt and comp_param1 being read from an invalid address
> if not using driver model. For comp_param1 this may not cause problems if
> reading from addresses close to 0 happens to be allowed, as high speed is
> only supported by DM code. But spk_cnt is subsequently used to calculate
> the bus periods and so this may cause problems (e.g. on spear600 board
> which has not been migrated yet).
> 
> Add a new parameter regs parameter to calc_bus_speed() and add more
> comments to this function and to _dw_i2c_set_bus_speed(), which calls it.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> Reported-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> 
>   drivers/i2c/designware_i2c.c | 34 +++++++++++++++++++++++-----------
>   1 file changed, 23 insertions(+), 11 deletions(-)

Applied to u-boot-i2c master

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list