From patchwork Sat Nov 23 21:26:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 13883946 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C31E819CCF4; Sat, 23 Nov 2024 21:26:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732397191; cv=none; b=He+h1Gf9YpBR7xD32lwmx91XskL8QrfAoxHsZ3OAnXhbPhi5phBzPNXI40YlO8qrBTQfysRh2hQi7ZjXRSSpANb0FDs5SRTpYU0bRe46OtGx/C6TdMPWSNnd9llYb++52vnmBI4kAPXOKmUOThUzWh2oMQBazs1651XyBwfLTMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732397191; c=relaxed/simple; bh=S9lNBdOz+fyWtttvxwI71Sb5SqCDucavC8LeLhcrfS0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dJm/ppKPyvYm/I60bF9BR0QrRb6eyZANi0kRz03D7PWt7D24Ul90Rx/h7kB2u3b92eBeAVXqa+OLJSQr94xILdm8eUUiGalchjXKrHMEPHM9gEdq2yxYHPbmeTOUeUyNbepRawXH5Bn9L4WSiRODmqwa/CNp7mrQb5MyOpR8lq8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JUarpqAZ; arc=none smtp.client-ip=209.85.160.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JUarpqAZ" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-46677ef6910so5777011cf.2; Sat, 23 Nov 2024 13:26:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732397188; x=1733001988; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hqUmrgUyN7wLvObgizlW92PtLkKJTPkx4qrgq2LwcbI=; b=JUarpqAZwJxZoznhWBc5sdq2p4uDJViIIR0yaweJ/Td9cyD+gs7gW67/jwahVWMs7+ HpdbEJm/jtTYkxXoiLP/gJUFbecXWLjsoekwNVioC+vnMNwlV/JlmOxhV5vJfflfjQfY 0rbbTKVfT5eNUROSmxLvkjVK7k5HSqqoBK9+zz2GVMrUyuC4LOuvGAdBqV5NNA3XPo6g jHaTi/c3OOnBu3ABEBXhu0unz82VKrLEmCrhlBTWsBSayiFwBvqTqDianH+6eg7haCc1 4iPwGkY5y5MTyrxZG4pkDUxti8P6z9xzmQYA8UPR6jKeXFxZPLVAUNeaOfjEIAI+JPei DTAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732397188; x=1733001988; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hqUmrgUyN7wLvObgizlW92PtLkKJTPkx4qrgq2LwcbI=; b=QQ44x6YCXCv4OjLa9J5Fmz3i6iTXtBqEPnQekLw5q9SZVK0bRNsTDLPwDtQq8U8P/W qLLFiOw/maobuuR/91bRLfH/r+OgVOZDsBlEeE2Mr3aRe24VF5ClLTGlaNImXpm5Y751 XEGDrSEOWma8Nq+vmqlSAVAjE4h6g5DcQDj4WzXf8xqAcgvBRKmF+jKUY5+uA9ouYHXi bjAd1+U3VgSSnvXBLDS+pbmA/B3HIzR0mP8ioXd01Oc9uv4SwpGWFORXB6QXNtY/iwr6 pwYyrzvfEF2gXjIa7mJqoM60xESWLLLBz1/8Bt/46b65v3M6QNjZ9m80FyDwZKxnaJrt JNvw== X-Forwarded-Encrypted: i=1; AJvYcCUpOpqBlv34zCGhvfr1lc3dYzY7coMuph4UVUjXRepXWWHaaxG/2y/qhjyZhD22h1Peh3l6rL3O5c+BZIWOsb1tiV4=@vger.kernel.org, AJvYcCX6V18ov77hnckE8U06aIoeej2iUjE7CGz4IoJ6SO/N9174/kaRDzdNbvfcF2oQav/bkuyg/S2PZFAdUu0=@vger.kernel.org, AJvYcCXHIDDAGVScHJs9hdC+jHn6gCWij3gYfkpKtcB4sbS3lapV7D+P6ywsBKeKoyuM3Ab8uc12RV7N8LBiSpk=@vger.kernel.org X-Gm-Message-State: AOJu0YztjWYGEEN/+xURI8bJc3Jdb8oZ/Zs64wcjLPjOS2ALuNz/8fKG z7wR4/ApRxdtSyV4M1D+g3Y8k3SwoQstaApaCd9/ywR0IS0Kh9vX X-Gm-Gg: ASbGncs3WnP801GVje9EviEYJXY3wkXABE9tlGAVseB/S22K+3wouiKjnxgKY+q8JUA CGx2Tn7Y5GmyL1zZOk/0s+or+BhveYbUu4nHhjo3Hfg7e4NbKst3kjylMbcROMw0nplmLX+q4nQ uF4MVsUSwItfpnMeHKS1vgVrH50B0yA7k2rE9U3v97GxQECoNpRAYEVbg+fsvDg0ZSeD9IDpxUJ SwdzFQV3HsbwW0uqohtaQ+5osGaGVbfpQxX2lP0M5ue5jf2DO54srA6xOQwjm+jsGWcMRfF X-Google-Smtp-Source: AGHT+IGVeho4+d3L/Ey18kxCOJChbkbT+3uU9PNEA4MwfJkMBnoVjxtA356iLEH6xkrsXSKgRSWvdw== X-Received: by 2002:a05:622a:5c06:b0:464:af55:64ab with SMTP id d75a77b69052e-4653d6367damr127407211cf.50.1732397188592; Sat, 23 Nov 2024 13:26:28 -0800 (PST) Received: from newman.cs.purdue.edu ([128.10.127.250]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4653c3d9c14sm27763811cf.15.2024.11.23.13.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Nov 2024 13:26:28 -0800 (PST) From: Jiasheng Jiang To: krzk@kernel.org Cc: sylvester.nawrocki@gmail.com, mchehab@kernel.org, dron0gus@gmail.com, tomasz.figa@gmail.com, alim.akhtar@samsung.com, kyungmin.park@samsung.com, laurent.pinchart@ideasonboard.com, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH RESEND v3 1/2] media: mipi-csis: Add check for clk_enable() Date: Sat, 23 Nov 2024 21:26:24 +0000 Message-Id: <20241123212624.6237-2-jiashengjiangcool@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241123212624.6237-1-jiashengjiangcool@gmail.com> References: <20241123212624.6237-1-jiashengjiangcool@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add check for the return value of clk_enable() to gurantee the success. Fixes: b5f1220d587d ("[media] v4l: Add v4l2 subdev driver for S5P/EXYNOS4 MIPI-CSI receivers") Signed-off-by: Jiasheng Jiang --- Changelog: v2 -> v3: 1. Correct alignment to match open parenthesis v1 -> v2: 1. Power off the phy and disble regulators when clk_enable() fails. 2. Remove a redundant space before the label "unlock". --- drivers/media/platform/samsung/exynos4-is/mipi-csis.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c index 63f3eecdd7e6..452880b5350c 100644 --- a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c @@ -940,13 +940,19 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime) state->supplies); goto unlock; } - clk_enable(state->clock[CSIS_CLK_GATE]); + ret = clk_enable(state->clock[CSIS_CLK_GATE]); + if (ret) { + phy_power_off(state->phy); + regulator_bulk_disable(CSIS_NUM_SUPPLIES, + state->supplies); + goto unlock; + } } if (state->flags & ST_STREAMING) s5pcsis_start_stream(state); state->flags &= ~ST_SUSPENDED; - unlock: +unlock: mutex_unlock(&state->lock); return ret ? -EAGAIN : 0; } From patchwork Sat Nov 23 21:26:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 13883945 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D68113B288; Sat, 23 Nov 2024 21:26:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732397189; cv=none; b=mESxTcVPxtE0KERYiRY3tRxpI7BpA6LJG+zBmGSiXxwYQWBmtdJWG++oGUYcDoq3NtNKpC4ul3f6wdspqvtai79EF5qjaGubvzle4rbig+twoi93xytrvT1Wl8eIr6Z9rPFZUe9JzIijt9SyFlOM8bOa7QkvGwupDj5ct8Wpd8o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732397189; c=relaxed/simple; bh=E/5sdOL/jkUCbV3WEL3b/0KOfVk/fXbHHdo2d90g7Q4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=SXP9J3hepgoI4YW9FooOWeHs/0HQm1Ovl5jnet+u7ZFmVWjTWt/Ij2FR30ta313S/Kp/dmaoqRi4vLno4LePbdZukO3PemogEQ1TTewyXUr6Ij3siwQyucdBrXgApfFyHMbw5u92JcWVAMQ7CEMIji+Ix4HoRjw0PkCrozlyMIU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fLqabWus; arc=none smtp.client-ip=209.85.160.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fLqabWus" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-4613162181dso22370501cf.3; Sat, 23 Nov 2024 13:26:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732397187; x=1733001987; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=m8k+BU9sp4jwI3J04BZciS+UktHrfNJa8h5d00+WG0I=; b=fLqabWusBrfsSCfqc3cWPR/k+ENJbPoS80jK49K+Wi7ROJHtg04MXu2OQmOqm0stOL a6k3DDo7qkMZU+YK589mTjpwcnrHAnh7mU1ScVzkbXrP3j+dz1n9R+xmoTDVK4SN631z +UA2JNcRmn5s3twb5gygPEQ3k57c0gjNL67q7tnEYmeAYKMTg0kxrccHXCWc5+sOe1x1 fmVWideJcUNdKeRvadhs/JSlU/jR8EpTo5e1QDeStzDS89bVLC+Yo1b5cZ9VHkUi6r9j 91jlF5bTRTDf1Jxh6o6dz8SajZyXm3EZtZDXWcY2//h3L/keLGRjY8o2lZWyDxhraXHX OMnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732397187; x=1733001987; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m8k+BU9sp4jwI3J04BZciS+UktHrfNJa8h5d00+WG0I=; b=euV5WzK5sMP9356C/bSoBRUkQRpwVMs5VNpy3+G1MgBypDYphC552uOLjZ7BX7MEUz vk2OZDOzYDCH/9dtaJTMjxBzPjAb7b0z8GW2bYSRaoq6XmXZ7EmsxDu6UVOrzH9VXMr7 uFImPXsppCD0llnXhYACe9bo7S/fCJhWjPqMGpg9P+eRiVzETUZZw8oigZqC/9n80gUr 6tl8BnPo6ALeVHyYuXfXZobHmCt0u+klIgOae/1sV51Xfl52Qgyuzx491XjJIBRG6maz 7hQL3v2jgKtQPi3hB/tZA/tt6+tZ8hNofYU97kfDAkec+JTd8Q7nXFgVeGSdoVaIb9Zk l+hA== X-Forwarded-Encrypted: i=1; AJvYcCUA8ixNqBtqbSQ6PbOJbHBN3WATRbMWHPHwkTD79ogU81gqhV1SncIgH4ymaV/lMDkDUVqojhvpyuzGlvILD8pj36k=@vger.kernel.org, AJvYcCWqlPc8FqHTft44qWD1fe7syGLkrjVYQml6zlKNkD6JA160N5eVm7bribT3P/6ZfJ8rE1I+3iyJbX+hooU=@vger.kernel.org, AJvYcCXfiOLOsRVX2TSxqSvWTiudD1zzd6pGBd5TJygIIQq7gWApoaxKObEbyR7ESwH2BwKPYw+AfbanXCLjFIs=@vger.kernel.org X-Gm-Message-State: AOJu0Yxz830nTmZAk6W0ZxlX5/FICEWVenNUoROL9HxIcG4ylcGLqjP9 Q1hRj8DFpsvGOBZTnf+0fV9clcAWAjXaIwOkjstolQCisHzkNs2c X-Gm-Gg: ASbGnctTG4F+zSUQK+8gTBq9G4uEX100uq7k2UEA3Yx02drwA6vkxDX38K5ssorL0NN WoiiMGzI6G4FF5dEeEP64dV0HUXq7gZE52ytRK2/SkcuBBzTr35v+ehEwuY0xhY2HT29sj6jWYC VS5LltPwSg8ren+U2r2v7+CKcb2pNuX0Yp8BiLyrEegydG3LAQw0KuNoCJZoSJ3vyMQ1J2WI8Zm nfkmayEHHFIVUzr40sKnNVcT+PQxMPvFk4FweMuv65j83KDZv5EMB8g1CmNi3PG70uys/VC X-Google-Smtp-Source: AGHT+IG5PKwkaZdfHENRxLK17QUpoYrvU5jJ1tBVCBUSAkJvvZxzWp3amwDBrzNlQ0M668EVPCFsuA== X-Received: by 2002:a05:622a:13c8:b0:460:ad75:300a with SMTP id d75a77b69052e-4653d620415mr115969591cf.37.1732397186893; Sat, 23 Nov 2024 13:26:26 -0800 (PST) Received: from newman.cs.purdue.edu ([128.10.127.250]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4653c3d9c14sm27763811cf.15.2024.11.23.13.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Nov 2024 13:26:26 -0800 (PST) From: Jiasheng Jiang To: krzk@kernel.org Cc: sylvester.nawrocki@gmail.com, mchehab@kernel.org, dron0gus@gmail.com, tomasz.figa@gmail.com, alim.akhtar@samsung.com, kyungmin.park@samsung.com, laurent.pinchart@ideasonboard.com, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH 2/2] media: camif-core: Add check for clk_enable() Date: Sat, 23 Nov 2024 21:26:23 +0000 Message-Id: <20241123212624.6237-1-jiashengjiangcool@gmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add check for the return value of clk_enable() to gurantee the success. Fixes: babde1c243b2 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface") Signed-off-by: Jiasheng Jiang --- .../media/platform/samsung/s3c-camif/camif-core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/samsung/s3c-camif/camif-core.c b/drivers/media/platform/samsung/s3c-camif/camif-core.c index de6e8f151849..221e3c447f36 100644 --- a/drivers/media/platform/samsung/s3c-camif/camif-core.c +++ b/drivers/media/platform/samsung/s3c-camif/camif-core.c @@ -527,10 +527,19 @@ static void s3c_camif_remove(struct platform_device *pdev) static int s3c_camif_runtime_resume(struct device *dev) { struct camif_dev *camif = dev_get_drvdata(dev); + int ret; + + ret = clk_enable(camif->clock[CLK_GATE]); + if (ret) + return ret; - clk_enable(camif->clock[CLK_GATE]); /* null op on s3c244x */ - clk_enable(camif->clock[CLK_CAM]); + ret = clk_enable(camif->clock[CLK_CAM]); + if (ret) { + clk_disable(camif->clock[CLK_GATE]); + return ret; + } + return 0; }