ii2c: i2c-master-msm-geni: add null pointer check in event call back

Currently i2c geni driver doesn't have null pointer check condition
in event call back function. If any invalid event is coming from GSI,
i2c geni driver accessing null pointer which is causing crash.
To solve this added null pointer checks in event call back functions.

Change-Id: Ie14a40eee846c0ea29bec512d6320e9548c509b5
Signed-off-by: Anil Veshala Veshala <quic_aveshala@quicinc.com>
Signed-off-by: Mehul Raninga <quic_mraninga@quicinc.com>
This commit is contained in:
Mehul Raninga 2024-09-16 11:59:35 +05:30
parent 172a1a35eb
commit 2f2ca4f158

View file

@ -351,8 +351,16 @@ irqret:
static void gi2c_ev_cb(struct dma_chan *ch, struct msm_gpi_cb const *cb_str,
void *ptr)
{
struct geni_i2c_dev *gi2c = ptr;
u32 m_stat = cb_str->status;
struct geni_i2c_dev *gi2c;
u32 m_stat;
if (!ptr || !cb_str) {
pr_err("%s: Invalid ev_cb buffer\n", __func__);
return;
}
gi2c = (struct geni_i2c_dev *)ptr;
m_stat = cb_str->status;
switch (cb_str->cb_event) {
case MSM_GPI_QUP_ERROR: