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

Commit cf206773 authored by Shankar Ravi's avatar Shankar Ravi Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: sensor: unregister subdev if cpas registration fails



In case if the CPAS registration is failed before freeing the
memory of the subdev, subdev need to be unregistered so that
subdev list entry will not become NULL and other subdev can
be added.

Change-Id: Ibf6c336225c50dc6a5868ec94b076377fe975715
CRs-Fixed: 2708016
Signed-off-by: default avatarShankar Ravi <rshankar@codeaurora.org>
parent 56861a75
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, 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
@@ -188,13 +188,16 @@ static int32_t cam_csiphy_platform_probe(struct platform_device *pdev)
	rc = cam_cpas_register_client(&cpas_parms);
	if (rc) {
		CAM_ERR(CAM_CSIPHY, "CPAS registration failed rc: %d", rc);
		goto csiphy_no_resource;
		goto csiphy_unregister_subdev;
	}
	CAM_DBG(CAM_CSIPHY, "CPAS registration successful handle=%d",
		cpas_parms.client_handle);
	new_csiphy_dev->cpas_handle = cpas_parms.client_handle;

	return rc;

csiphy_unregister_subdev:
	cam_unregister_subdev(&(new_csiphy_dev->v4l2_dev_str));
csiphy_no_resource:
	mutex_destroy(&new_csiphy_dev->mutex);
	kfree(new_csiphy_dev->ctrl_reg);