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

Commit 663b41e7 authored by Srikanth Uyyala's avatar Srikanth Uyyala
Browse files

msm: camera_v2: handle the error value returned during get clock



currently only NULL pointer check is used to validate the return
value from clk_get, this change to handle all the failures.

Change-Id: Icd8b7e33d0f235a7c5dde2307972a594908e6a60
Signed-off-by: default avatarSrikanth Uyyala <suyyala@codeaurora.org>
parent 7f5e9be6
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
/* Copyright (c) 2011-2014, 2017-2018, The Linux Foundation.
 * All rights reserved.
/* Copyright (c) 2011-2014, 2017-2019, 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
@@ -367,12 +366,13 @@ int msm_cam_clk_enable(struct device *dev, struct msm_cam_clk_info *clk_info,
		}
	} else {
		for (i = num_clk - 1; i >= 0; i--) {
			if (clk_ptr[i] != NULL) {
			if (!IS_ERR_OR_NULL(clk_ptr[i])) {
				CDBG("%s disable %s\n", __func__,
					clk_info[i].clk_name);
				clk_disable(clk_ptr[i]);
				clk_unprepare(clk_ptr[i]);
				clk_put(clk_ptr[i]);
				clk_ptr[i] = NULL;
			}
		}
	}
@@ -386,10 +386,11 @@ int msm_cam_clk_enable(struct device *dev, struct msm_cam_clk_info *clk_info,
	clk_put(clk_ptr[i]);
cam_clk_get_err:
	for (i--; i >= 0; i--) {
		if (clk_ptr[i] != NULL) {
		if (!IS_ERR_OR_NULL(clk_ptr[i])) {
			clk_disable(clk_ptr[i]);
			clk_unprepare(clk_ptr[i]);
			clk_put(clk_ptr[i]);
			clk_ptr[i] = NULL;
		}
	}
	return rc;