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: 13883944 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14418E66885 for ; Sat, 23 Nov 2024 21:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hqUmrgUyN7wLvObgizlW92PtLkKJTPkx4qrgq2LwcbI=; b=ot4i6GsNIZMrUXWK8gAH3xt7y5 h0LnFyzGsPI7zNbAHyXL4/4KtUf7RODv9ez/V7n1yuGqTpdvgr8e16RsXwqoz3U7roF2xrZv4uxVQ ShcdHqM5QynNMriF949e82NZUaRSYG6qeVHLA42kp4NeIPfD/XAwEhZ8CYQNgi/IDoK0kIHFDotIy URuB4mKQo46flkakuYULIPLWi6mULgvUqvz7+hhGJE9zOzDOfeSGJzKMtPdlEaTAs0PLFzPseuBK1 WJC1IbK6tdxg7WGrV3KLhZ406307re89R+C2f8fHSo+fLJ1i7Sr7A9h98ocoNISY7yfsujTnUP5Si VTB+HBBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tExfz-00000004uEQ-0Tua; Sat, 23 Nov 2024 21:28:23 +0000 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tExe9-00000004tzL-3JTb for linux-arm-kernel@lists.infradead.org; Sat, 23 Nov 2024 21:26:30 +0000 Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-46677ef6910so5777001cf.2 for ; 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=lists.infradead.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=Zxd4dmp86ECJSu7nyxbQOQ8u+WBus58bu+v4j/WvWjWsiHdFFx5mbUrkrKdjdxoMdn EE5kLME8eUd19QnZHak2C55MHM5Thn4SgTPi9qpbUSWOIeTVo0LJEOzr5RXgyG2koewM zNAJm4kwpOqcNPhuPI5rSDBSITMk7X8wKG2k57/Nx2U3iVvRf2mGqGBfMq7xsA/Iv2z/ fhHfdnHf8avTdU0zHzXzIbbd3U1WXjuch+fCk+Zrq76WWRizZ4b3mZPqdAbyL8HSHwKA OZS0gCXXD3y00u2xrTC+zInpqCw2GI4yfO9do/lPHMLHwRVbC9TOx4xA3EUBHVxGTfG1 6K0w== 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=CfcArurJBNXz8YkYdg2G424E3cNszFr85C489ftQGjJDO8UWp07zxNFpWxHESHpZWy 9qbOJ+CuplfHuGVkvYqgrrrub9wFQregAnImVutpMuFL8+5eo7tbzWD0+REBYVm1FcKl /EOSeE+6SkhCil8XwLStm98iMl26I9cu8RVnoTW2VtBqklRqDLNTblAz+o5pI3akt8Lq buFXm6GzbSFleJjDzbAHpoxBN2uYFTUbW80RiqSnzFHHXlihEZoi/8BW6XM4aD9SlLFX Vc8owGHf81VAOirNroY0TZGLziY5AiBh9Wk+tuUGyuk5lG9/sfQ/ZJq/UI8WaK1mswsQ khkQ== X-Forwarded-Encrypted: i=1; AJvYcCVlGsvzCPYsRy44sA+PU4YrWtcAprVELx2clUHvj80BOI0qbKEES5JMVWevkEJc4xtwHGNmpyqo4Yo9/UUDrHjm@lists.infradead.org X-Gm-Message-State: AOJu0Yzne3qW3RPOnK0TF/wNxJq/IlmJApkVNf/DoXS2S68lj/8mSfHL OQul4XgY+NT1JjeAleNoKAx6qUDSuYLjJfK6UihToPJijXStu9yX X-Gm-Gg: ASbGnctPk+SzQKptcJrAuUy5KVFG0UGI3NT5gJ/O/W8cIgxrK/K9kOA8iqPY4fOGtvP Qk4NBYDH58Mm7MR8SJsa4KocWEFt5k6GBgGjtX5YhTdy8VuQNdVlicojQGcKR3RHQGuALL/tqBF 1LF7ITh8Z4sGW2if8q5AMsWWncF1QSop9Qo6GtSJLQH1HQXuHQJd7sTBVo/35t7KWeAnvA5/7+v 9e2bjg/L1EKjLtWtwtXIo9/zGLk09ckvZ1ePRgwlNDTu4HlzvSeZKIwMjQn/9HdmptG+Wyk 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241123_132629_828883_C2946F59 X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: 13883943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CF6C2E66887 for ; Sat, 23 Nov 2024 21:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=m8k+BU9sp4jwI3J04BZciS+UktHrfNJa8h5d00+WG0I=; b=tyEwZNq+BpRt+mcItrg6MY48jd W5FfeSeAJE219mz3KwaTd1G3MLUAIz1jkHSTnNTQYumeavLdvd4UC0+nOUDzLP7pqGz5EjenQ8lhN tXb5G5XHRl0DxXNUtqaIjwp4C7YYLGh1q1h03zYBwuVmjspwS1OXoRj5ikspaUbNGKEb7Putq3JZe bejubQnl9UFj6ta23CzHQLohig9EGKrlCe3qC5w2M3gjCzAyOmEB4TwbhscED/BCqktd/GTzgyK/7 EaJljwmSfy+n0FwDSKAv5wVdiKTnY7ihb63KVYVEeNX65nA4lrxrW/ZCS1SpXlnvKkXxNbHm+tRlI 5VPnM0aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tExf5-00000004u8M-0wxq; Sat, 23 Nov 2024 21:27:27 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tExe8-00000004tz4-1m7E for linux-arm-kernel@lists.infradead.org; Sat, 23 Nov 2024 21:26:29 +0000 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-46375ac25fbso24488281cf.0 for ; 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=lists.infradead.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=EU23jtKhlXQWfK9qwzzCzGXdgFB2XUn+LU5kGXjfNaqb4z9hFKwVEmjsLIF3HUeAiY OHLGBAqtW6cr6zoFkE2pONriSXrdLmktVubqIclwC3XlkDZd3RHK3PjiMnvsBG7OUu7l mv3MGi4bBNjnsV6d7lteQ51wlcE2u5GelVxTdHWswGoqBPqb6cEFffafv9bm6I0/Uf+W +lDiAUodDQykDaZgclb/93ifwtBUF735Zx3hx9h7csHpKdn6AlFn9D9Iacx4tu2554Wc taRwFy7cmpSoy414/dG4KA67gVw+KkWNb+Z2SvsaqjiYQiTrc8M6sfyG43t+owKHSyhT a66Q== 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=UTkih9dR+JT9GQMtiAzP2qyNJL0KbrGxuORRUlTuwQHRxMmlprkD8sec8BPMx5qEwM DIHDE86DDWCbyLPnvBxq3Sq+zodidMv3GLlaeBqRpSnIJzbZtyTZEMKfNDknpvX58Un7 6HFE+6UWQa3fffoZW0yktyYjO0AscX1bc/OaoZgZFuI4TdWKaA4TCnSzqPhKyYnUN+2D bjreEKa4w+fIIs0u1XwnNHFbpCbFI0wl4hGLHp3clfvR5ZrxjmDbTNaQCCNrCr8pM8a2 NmYG7/VwYgSmvYiyqGzcT9KWQeHC7e4ePvZS/vGwinMrmVavcNiKBu0VSES/cI3tSK3w 6nBg== X-Forwarded-Encrypted: i=1; AJvYcCXcVnBm3E236lRzEWia/SeSv26uySHVLhuVKFLHddOXG0fasIVSLZy0VeiO5mDclH+jh6u0Nj0SmM/n2nHb/7wa@lists.infradead.org X-Gm-Message-State: AOJu0Yxt7Xc0FlCh3WROj2uzfXPNOqcWNDk5yEOBxia6geo6KBAvXLla ApZNcEZ2NYhb83v2WHvnbNr0v7JuDBuT6spiT0E7vi9Vp7sNe8OZ X-Gm-Gg: ASbGnctGuT8g68vnam9vnmVPJWM/ccUFSVJa1EOXBr9/0fJfYDsAfGCd6Wv/UaFp0mB G1SpHD2PhgLI14GWWcpBiyPj77M66K6Lp3FQ20+Eq3eeO7Vl4af9cdvYohF7t8Ke8KyR5/E4cN8 WlkiJnB/C71lNsRR4jRcmnl4EjZMMN3cO29ZNRFgxHpNmgibhcrpk/+1qvlMn8GQ6o6q7UIvJM4 giWtjmFufzzBhMkCXmfoXQR4Hp4UGzka6iua4bO5hSgJMtL4F/2XUlOZApEAScXUHPGbA4H 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 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241123_132628_475878_6E6B1C02 X-CRM114-Status: GOOD ( 12.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; }