i2c: mlxcpld: Fix wrong initialization order in probe
authorVadim Pasternak <vadimp@mellanox.com>
Thu, 16 May 2019 17:15:41 +0000 (17:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Jun 2019 07:17:18 +0000 (09:17 +0200)
commitd2d8f64012543898a0158b1fc5c07af3d41c89d8
treeb1ded6d755181c3d35a020f94ee9a4569cc1d195
parent88ad86b807823791ab4f87b25f2100dc6189d3ba
i2c: mlxcpld: Fix wrong initialization order in probe

commit 13067ef73f337336e3149f5bb9f3fd05fe7f87a0 upstream.

Fix wrong order in probing routine initialization - field `base_addr'
is used before it's initialized. Move assignment of 'priv->base_addr`
to the beginning, prior the call to mlxcpld_i2c_read_comm().
Wrong order caused the first read of capability register to be executed
at wrong offset 0x0 instead of 0x2000. By chance it was a "good
garbage" at 0x0 offset.

Fixes: 313ce648b5a4 ("i2c: mlxcpld: Add support for extended transaction length for i2c-mlxcpld")
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/i2c/busses/i2c-mlxcpld.c