UBUNTU: SAUCE: i2c:amd move out pointer in union i2c_event_base
BugLink: https://bugs.launchpad.net/bugs/1773940
"Unable to handle kernel paging request" occurs at this line of code:
privdata->eventval.buf[i] = readdata;
The pointer "buf" in union "i2c_event_base" will change its value as
soon as any union member gets modified. We can observe this behaviour in
amd_mp2_irq_isr(). This makes buf points to the wrong place, and causes
the trouble we saw when it gets accessed.
Put pointer inside union is not a good idea, so refactor the structure
to make sure the pointer and the union do not overlap.
Also remove the NULL check for eventval.buf, as its value comes from
read_cfg.buf.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: AceLan Kao <acelan.kao@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>