Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b06e33ab authored by Rishabh Bhatnagar's avatar Rishabh Bhatnagar Committed by Gerrit - the friendly Code Review server
Browse files

drivers: esoc: Add null check before calling pon functions



Add a check to detect null pointers before dereferencing them.

Change-Id: I22cbe09f1a6b4cb368831e508b8849d5c2b135c5
Signed-off-by: default avatarRishabh Bhatnagar <rishabhb@codeaurora.org>
parent b4bd4a71
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2014-2015, 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2015, 2017-2019, The Linux Foundation. All rights reserved.
 */

#ifndef __ESOC_MDM_H__
@@ -123,27 +123,39 @@ void mdm_wait_for_status_low(struct mdm_ctrl *mdm, bool atomic);

static inline int mdm_toggle_soft_reset(struct mdm_ctrl *mdm, bool atomic)
{
	if (mdm->pon_ops->soft_reset)
		return mdm->pon_ops->soft_reset(mdm, atomic);
	return -ENOENT;
}
static inline int mdm_do_first_power_on(struct mdm_ctrl *mdm)
{
	if (mdm->pon_ops->pon)
		return mdm->pon_ops->pon(mdm);
	return -ENOENT;
}
static inline int mdm_power_down(struct mdm_ctrl *mdm)
{
	if (mdm->pon_ops->poff_force)
		return mdm->pon_ops->poff_force(mdm);
	return -ENOENT;
}
static inline void mdm_cold_reset(struct mdm_ctrl *mdm)
{
	if (mdm->pon_ops->cold_reset)
		mdm->pon_ops->cold_reset(mdm);
	return;
}
static inline int mdm_pon_dt_init(struct mdm_ctrl *mdm)
{
	if (mdm->pon_ops->dt_init)
		return mdm->pon_ops->dt_init(mdm);
	return -ENOENT;
}
static inline int mdm_pon_setup(struct mdm_ctrl *mdm)
{
	if (mdm->pon_ops->setup)
		return mdm->pon_ops->setup(mdm);
	return -ENOENT;
}

extern struct mdm_pon_ops mdm9x55_pon_ops;