From 80ee335f88787d2513e660088738afdd5f655009 Mon Sep 17 00:00:00 2001 From: Junghyun Kim Date: Thu, 18 May 2017 12:49:03 -0700 Subject: [PATCH] platform: auto: Initialize pwm as NULL Initialize pwm variable to NULL and qualify it before using PWM functions when pwm is not defined in DT. Bug 1926727 Change-Id: I2a7ab201645f4a4d3158bbfc281adea19ffd6cb5 Signed-off-by: Junghyun Kim Reviewed-on: http://git-master/r/1485097 (cherry picked from commit b9f147d439b6f5b0bf28f5f4791ca0e6e862bdcd) Reviewed-on: http://git-master/r/1485345 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Songhee Baek Reviewed-by: Gajanan Bhat Reviewed-by: Arun Shamanna Lakshmi --- drivers/media/platform/tegra/auto/isc_mgr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/tegra/auto/isc_mgr.c b/drivers/media/platform/tegra/auto/isc_mgr.c index ba012878aee4..5a1954e3c3f5 100644 --- a/drivers/media/platform/tegra/auto/isc_mgr.c +++ b/drivers/media/platform/tegra/auto/isc_mgr.c @@ -530,8 +530,9 @@ static int isc_mgr_release(struct inode *inode, struct file *file) { struct isc_mgr_priv *isc_mgr = file->private_data; - if (pwm_is_enabled(isc_mgr->pwm)) - pwm_disable(isc_mgr->pwm); + if (isc_mgr->pwm) + if (pwm_is_enabled(isc_mgr->pwm)) + pwm_disable(isc_mgr->pwm); isc_mgr_misc_ctrl(isc_mgr, false); @@ -798,6 +799,7 @@ static int isc_mgr_probe(struct platform_device *pdev) atomic_set(&isc_mgr->in_use, 0); INIT_LIST_HEAD(&isc_mgr->dev_list); mutex_init(&isc_mgr->mutex); + isc_mgr->pwm = NULL; if (pdev->dev.of_node) { pd = of_isc_mgr_pdata(pdev); -- 2.39.2