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

Commit 5144b59b authored by Shashank Babu Chinta Venkata's avatar Shashank Babu Chinta Venkata
Browse files

drm/msm/dsi-staging: add check for regulator count prior to enable



Add check to ensure regulator information has atleast one valid
regulator prior to enabling it.

Change-Id: Ib35876bd3da53faf237fde15f7fba99d3f3a213c
Signed-off-by: default avatarShashank Babu Chinta Venkata <sbchin@codeaurora.org>
parent b2bdf7dc
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -341,6 +341,11 @@ int dsi_pwr_enable_regulator(struct dsi_regulator_info *regs, bool enable)
{
	int rc = 0;

	if (regs->count == 0) {
		pr_debug("No valid regulators to enable\n");
		return 0;
	}

	if (!regs->vregs) {
		pr_err("Invalid params\n");
		return -EINVAL;