From patchwork Fri Nov 22 22:13:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 13883659 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (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 A1B9B19E970; Fri, 22 Nov 2024 22:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732313636; cv=none; b=ZQwmaRORjSlDCSCnv9KV3och64MmRhrF3zPxTHLM8blAT9JqR8KDvqy80LINwK4Yw+neTEFGFyQUNQt1Af0CXFND+NvvFPUuQX2lnM6/XzjIdSPzDmDPBwEUR9YY0FU7Cs8A03Iz+Do+DBX80lXR9eEWKe/u9rkFS5T1LVPqGac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732313636; c=relaxed/simple; bh=DpdC7/ZNvEIudhQajmJyElOpUZpYIkpkt/AxbbUhDTU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=E9mD4LYBmgmpGP50VC7Vmj2ntMZwReY93KgnnSwRovCn0Xxkjd/EZkrHOR02w2URhU3MFYI2TpNzsU7uro5titlJ0MoJ1+TSnp9rHEZ6T2rg9BmPMHoORoX6z1R4QGRO9zmJM+nYOWLtNzUI85rYkLIvY8Km+RdlRD/t+zU+4vA= 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=WrbKjt0c; arc=none smtp.client-ip=209.85.219.46 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="WrbKjt0c" Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-6d41176505fso22507166d6.2; Fri, 22 Nov 2024 14:13:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732313633; x=1732918433; 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=hjggllig1lhdLdqzta4VRtbrfyvu0W/JksHC0TyvPxI=; b=WrbKjt0ck5/mtZruwNQvXnhLQ5lLLkFxq1Ed0wU5UpEUs83zpKBp3tv4g31FQH/5VA jEARx20Jwbl89iwTG7IgqI6vOmUc6GIWaRcnrLueVeF25JM4sS8X3GsX1/DaXBkcorla 9sLXcI4w2JNmTDuRKvFk4OCPadZeOqZ3S4XXow1o7ZQOUlOIhzMmnmRCwVem06nOCjLh csk+oDNwfOdyNb4QZPep5LjN5BqS9i4Oq9UzSIsvqle2ZWvVNewebps/r0pegHLDVY6x aH7/P2+AiUBDzE7g+iPmZefIhjjCoHBe7T48ZAI46+mvoHtfx3wBRlES+yC/3BsmyPAV icxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732313633; x=1732918433; 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=hjggllig1lhdLdqzta4VRtbrfyvu0W/JksHC0TyvPxI=; b=ix5Q1cD3S9uwwbR4kR6+ryR1BiNoj0OOQr6MCywTtAuTvZWqZBTJUg1tfL1MAh65pw RuVqmIxn1WJFFGLQozQmfeyoKKeITKw9c9xfK1K9fLsBtln27K9nVJYAD+dX7pnESEIt Xm19SnOKZPFSnkpjfJlgsELLtY/kFlhfL3QSANJ7kSZktxNZ2B5TR+O22qYpkVGj5UOB cPvgKsgXaWiy/QtRIj0wV9YGIqPiFNqMEzbCvDuDsWlNgbIt4ZtWCYtbQOxwD2OtSw5B o5gT+0Y+T5w5O7Tbnt/zUP6j9CFhwLAzq5iaDagJeY5Ds5OFsYM4gbYsRFnkUV4CQw/i VgOg== X-Forwarded-Encrypted: i=1; AJvYcCU8mdHERCVA/o2ptC5Zfrz1TWfafMLCVPsZnbLG3/2M4J/MhQ90//cvl2nDHbSO63E7oSR2MFcoVe3LuWo=@vger.kernel.org, AJvYcCUfygcAOM8+lpyzsDLfLhEo/RUaf7uD2YDY6PzZfUGQg4JtvLkA/Sq/Fj5nhgH9ApWq2TSN7RiHXLcRFJo=@vger.kernel.org, AJvYcCVmdwxBx0/sGnFwf8ONug/T+CDHLQugD8gVET50tUihJUM+puCraxcBbppiH6dnur7LmOEds3wAK8AlFU/SCEN+XIg=@vger.kernel.org X-Gm-Message-State: AOJu0YwjcqkrYsPPEjDbf+sxF2pHo2GXCaW4kj+yCampz3JJYiPvdVZ3 HDCZfKPFzw4hSd1v51kjjoozq/xSiTItzA+vzoqHS54qn4JxlrWbltgvzg== X-Gm-Gg: ASbGncuV+fAGBJLy0NXC1nc3fXR1+sfLsbXW4/qSx/skZgt2/YkI80HIaZPCHl0k7jZ qyU09aPPK5UZ0XLdqZc6+oH3MYbfcH/Oj9mtai5twedXTj5vZs/EhhlDRXIQA8VuPGemx4UwiQ8 FZOnS1+GKKHr5eyBfs2Pbr/CdsNgtLwYPTkgttToKJwiAkhE0rT/bMZBI354mYDfmmX68h926tk F5L7HV4liG9DZbQaUYG92wf0oX1Be9Bws9WPKJp7daVF7up14mnPvw1M0GZV5ueOoWlh6qm X-Google-Smtp-Source: AGHT+IHgahotrjDkGCxkLTqv0ks7LfpHmWKZFhzn74QSP3dQNY6KwyiDyyINS/ZltTaefntCRc+JvA== X-Received: by 2002:a05:6214:d81:b0:6d4:2a73:846f with SMTP id 6a1803df08f44-6d450e7b40amr61235776d6.11.1732313633452; Fri, 22 Nov 2024 14:13:53 -0800 (PST) Received: from newman.cs.purdue.edu ([128.10.127.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b513fa5feesm130646485a.30.2024.11.22.14.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:13:53 -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 v3 1/2] media: mipi-csis: Add check for clk_enable() Date: Fri, 22 Nov 2024 22:13:48 +0000 Message-Id: <20241122221348.3998-2-jiashengjiangcool@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241122221348.3998-1-jiashengjiangcool@gmail.com> References: <20241122221348.3998-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: v1 -> v2: 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 Fri Nov 22 22:13:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 13883658 Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (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 8F4F41DA5E; Fri, 22 Nov 2024 22:13:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732313634; cv=none; b=qlwS711IkmlIi4omYmH7OEI6lhGlO1/Osbx/lzIxJ+U/cFjs5p6iNCgJdSyDHtHuM01mj/ONEwH27qrqR2B83aCqlKqF1+IY+Rs/aeuFLHaTNc7APhKKj2XHVgPlizDS7jwrwzab/v2+CBea0W+VXPnTLpiPwpfnv0cy61a+2jA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732313634; c=relaxed/simple; bh=E/5sdOL/jkUCbV3WEL3b/0KOfVk/fXbHHdo2d90g7Q4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=rf8BC/uHRSuxRrqiNOigCiLTbpkAhlMksO1NEeGCy/oMfZ5lKMK05xZEjoVthZMoUf0dSgGrgtEnVTb8HzyrPB2ZM6MnqYgZRRp+59Qoaor0RpGr1Xl5f0I7pvZjW86WsxuhYNl4LKKb5x7IpVBdvxB8J+LPTd4XeHGWGjIlvSM= 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=Lfhdpcwe; arc=none smtp.client-ip=209.85.222.171 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="Lfhdpcwe" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-7b18da94ba9so223586885a.0; Fri, 22 Nov 2024 14:13:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732313631; x=1732918431; 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=LfhdpcweOaQ6W4aNXbMBMw6uBNCXKVwUfO2hNxPJ9Qik3K9OdRVGm+8qB6fDsiJLZn 7r2qw810AeNVCsEcCD1L41A1iq47RxTJDs/997a0c6U0YEV2K6c+u7qOfq5F2Mdj8C8o ZYvAEaa7t87IFqt0fzmcM9Dk+yKi8yu2+f0r/ool+EFGrZOHFj90Iem+fYdQh9RwEqxd qIw25ey1ZsYvRcRsMpXYhNtB7L57v6lvQO4A95Nt7niumKHMW/tbncrMm6Hv+MV+mbf7 fULiWKPRRigal8u03u5s8otj7lmCd/vJNt5lK6Ibphikr08q3RnQ6TuGAOJnf2bPHPwI q7NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732313631; x=1732918431; 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=Xx2A2V8MjZGUNnbocTekPAvnbt1QK1SJaesCHnL4/rDyyPuFeAuawz8SgQPWhEAuLh +dwnIqm1pB68o6Befg0ej60orCUtqb3pTTFcO00ZLGRyh+EaR2PfZRbnPLJmkgKknnFL 4i1oXnEBoxj/Pq+O+u6XVx9o6/CdeGdDwjK3V7AlkeBfi9cVzbnn/VVPTfpi+cobe62B M/qTPJYIfNhYw1v+0LAZLgUnodJMEvi2lmemgWHE3KxXVZ1bAZMOyQr4tLXEbpk6g4zb 7Gn2sQvgxEc+3zKLK4Aci7BTjPowbzP8xIKI1lkg9TCB2R/TPQt4NyIawjb543qzxkwc Y5sA== X-Forwarded-Encrypted: i=1; AJvYcCV6PwF3M6JsXjhoCNFcEnJBgl4dpNqudhtGoz97yj3IfCtwDS1bb7OLhRhYxtPGG42qjFNj+KI9YR9mnSY=@vger.kernel.org, AJvYcCWhy+zJUgg3aOL8UuLXJ/ji7Wov/Bb8qf7CggGHIEAxPgiuHZ/VwOFZuJLCChWIfe65jOYKlI/TjaaiITs=@vger.kernel.org, AJvYcCXYx+zsvgCM5Yv13h/ZRP6ItBaQbykhobxbKz35sI94EKRV5LSeXd3td93ZJ5Ztm25wxhn2YB1hAI13mN4Zo8eYqdw=@vger.kernel.org X-Gm-Message-State: AOJu0YxxS6b8DqnHKj2BHVRX0ibswizfNYo6OMUkiFTENYbCmS7kNbxU Af1Qedsz55PUldw0IVnlH6ZZJEoMQACTg7Z7TqE0zynznZtlixtz X-Gm-Gg: ASbGncsibr/aJbi1PnoovBVw6IzbB7nM4cuff4xAoA43HiVhcAmyRWjsmfOBxMOn82o Kk3KrrqIvNVDNdZZKfnu9+zJsKptPRKw4SSCsbv18fzXDa/d3fDrh8bAXCrdqMTY1zv6OgTllBy /GnlXGvKqMzZREuUC6Nn9rPAGqfc4BXBoGpUwWEWnZ88nK2CxZzY0+mOrpAphpjRDecBZnPsJnf w88f3EzNrE11xoE/nGAXanWlvQdCyKulEuv4HT9YzihcsKDQgNqoV4ZyJk2A49cKDq/F8Qb X-Google-Smtp-Source: AGHT+IEzJaoN3aH6zpKSzv+lhJWHLO6tx485UfeoF/qternotp83Yq1ZBtdBH+mLh7LqABjxg22dlg== X-Received: by 2002:a05:620a:2b9c:b0:7ae:310a:75de with SMTP id af79cd13be357-7b5143eb019mr779680885a.25.1732313631490; Fri, 22 Nov 2024 14:13:51 -0800 (PST) Received: from newman.cs.purdue.edu ([128.10.127.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b513fa5feesm130646485a.30.2024.11.22.14.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 14:13:51 -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: Fri, 22 Nov 2024 22:13:47 +0000 Message-Id: <20241122221348.3998-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; }