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: 13883656 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 9B362E6ADCB for ; Fri, 22 Nov 2024 22:15:58 +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=hjggllig1lhdLdqzta4VRtbrfyvu0W/JksHC0TyvPxI=; b=XutZuwhHf2lpzCk82hNrb0h8FZ 3ou9ypwtKznkkmZ1KwQoc3w9R3u0uTTFG6ZV9UtER+dQswkE1l8Lv5LGlFkEzctcS2rzmFPJrs5Pg BMIDtJrseMGh3Rd9AXcZQMFwLES8JgegcXrMhAPlq7P6O1RQsfK+b6s9aPFnReaHkplcdvEGVjF+U uuOrOgYYUzaAGjb/62nVXZaE3zDBP1fBT+rjgNw8teooXQr7cZCY9LYbAxIhf3Kh6rOworV7Y7VD6 KKGYBNVVMQ/uKEhyVoDuxB7n9e1jZfZvPuYkZuF3wwEMJAuGCERr9gXCsJcIIC9zcIxMuw5AkIzDG mtrl1w7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tEbwL-00000003OJv-2Bej; Fri, 22 Nov 2024 22:15:49 +0000 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tEbuU-00000003Nzz-39pN for linux-arm-kernel@lists.infradead.org; Fri, 22 Nov 2024 22:13:55 +0000 Received: by mail-qv1-xf36.google.com with SMTP id 6a1803df08f44-6d41dbf6cfbso17846636d6.3 for ; 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=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=hjggllig1lhdLdqzta4VRtbrfyvu0W/JksHC0TyvPxI=; b=i2twiy6odVr4l111qRRJgd1erEcPrwzA+54+D+gKsofT2xQsfTaAAhjyqyYdMLpRBv OeCQI/mIdMMJ27IxuNrXc2FDP6NUbtLsMAGsVhIZ4G3Utk0/j5jlrXM9UcvaC+l//qnO /y5qMZNKftwx94Ez9S8MzKuObPht6PSeIiTP1/i+O6tQtArFNHmozS8uvBEa8kvU4sNG C5chRmF13Lv+HI71iLUhe9Kw0Gl3ztyVmLyScgoHFxeSwAeijKYo7PvUsW3DtRn94jHz 0oTKOn1AdqtnjOXzER1AQulJ8V7ts9KScOqZAS8SnfCnzihNdbIGd4ZiL2dhV6Rp13Su uxxA== 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=gVSHaR/KOtIpgW6SWQ2/UycPpO35YYrCOomOuiH5bAISwIhN77lT+NsQYFQN+7fe1X e5LzNuM37amwl2K2sAcUqViE+Ep8bBEFilwxAoskaJANXZvaamMRqBjigYJuJD82tgYa Ju1lW6DET6ZSX+d8LbmPWw2qkGf5U0Le61WhlnG3755usoaGHElpxdyjCb/zDSqKMq42 tru7uX7TeRzkHtUUNF3vOo/OOWL+/dGB6nPHhxmgVXPIY69Xq7NyQ+09ZwQLREBZM1IM XfNO+3v5h7DkN3earMhoQG7fDj6TNbi9iZtdZO4oNPh3UWrDqXEcWmVquOBkIZrai78c VRxA== X-Forwarded-Encrypted: i=1; AJvYcCUCrAjEh6PO33R2WmDuxjEcdxzgLT3qGiJCzzNyp++RTELHISAUcsDwrZwrZpAsOST5I2RXSDk+K/G0wqsc1lx4@lists.infradead.org X-Gm-Message-State: AOJu0YxYZ/cf/c8gvsGPOohs0WKoWi9ApUXGE8rnJVveudJ4KNfIEQUW lGFgyN1DoHiU79YrY5RICj6PpvnrZXfI1Dx9cXPGrS81TmdxmL/C X-Gm-Gg: ASbGnctBt/Vz9q7tskK6ffIYCOxifwVkykZQMm4MldvZJ0Bnrg0meeYbaf/7/4MYm9F VkEJLGMMxEhTvg4vwAgBySUWIMXUyZlu1N1O8HttZrLjaltEyxTqf099zS1fzN2B3nltz18gp4v l0HVNI37ELPp28P4m7F8MMXcCpPQe9fQJUJgqrEQhQ3XMgCF+waWdi2Z/D1cIAi7yOmVJH9yUK3 C6Vez9zJdg0ybOEDN+PwEI/vUKZYFeh5kJ2Y0DlAV9YzYdIxjtI+jcULDVFQBcLHGcTL4cc 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241122_141354_784654_BF3C8C64 X-CRM114-Status: GOOD ( 13.05 ) 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: 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: 13883655 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 8CB23E6ADCB for ; Fri, 22 Nov 2024 22:15:05 +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=K2eUME4pOJWyWYJAMwICAEy3ot xJvke5nFHoTqz4yNYgSJTbODz6iyzfB/bXCo7VLZBENvc6lDqA8d+rnose9NoI0Ecvw9TUNCD3Iv5 Y+XFl67g4OQDfQ2JkPkoZR3zkVIIb2FyNpoZMZRW9x554TfKJMtvuwgOLFYDYppF7VwJg/tKGKG0O r76gwoa5kcjSBf4MiGEVMxUjBcHzkORHtA6Be2ScC5+l6Vkq83qEaZw8hrjOiKwQr+tDchYv9YiAQ eunSdPy4nmcbJPi0CNfHDNu/Kyc02vUgpXDNh8bgovAJxzGrhdP5j6u5ntmxA9nz+v4w/x+kSwV+i nfA68dyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tEbvQ-00000003OCI-3rQg; Fri, 22 Nov 2024 22:14:52 +0000 Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tEbuT-00000003NzR-0yox for linux-arm-kernel@lists.infradead.org; Fri, 22 Nov 2024 22:13:54 +0000 Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-7b18da94ba9so223586985a.0 for ; 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=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=V6U+NxR5lYX98nQJXCcR+cytgDxFneUwF7CM+AIYBT/avsYCoLQjprganCN4eVxrmy 6qGlEubQQg0tHEDusE8PwgntnvcjOHa0LwF1PFr/Zsqx0NwqkBEmR566+5F2+m1by3YJ 6kWpuorkhBkI2DeoGtgP7d3+BFa6aMxY4Q9b65X50k0KzuEYDcpCf16MY04LN266xDob mkfOea4WGIaBJqzWNM2fia3K3z5SY5TM3FeivD3FbNDz5ThLp/xBy+kYaf7VFIcfxbAU U8qP4K8/iwGauOME8w4UMf+CgH8RGY38cPP49kC1PGXQGH/bLW37yiQfgA9WhLzUKjsQ OxdA== 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=u3v57LfgYU85HyJLzMc4mKZNnpqPQLMYb24sU4ydyzeMlQryFQ7VDm5EsZGbL2DbfD NOXhkFcfRqpcPd6X5pXzXGYwJLHjua7d3soYpat098KM0Z14ZyhZOFRPiel3Oxylowvh 6Oy4jSCnF9gYRA6hSciPM4ewiUu9fDbH/D+XSj8MlegYtAJLGdQBLYB/b0iC03d8e8ca D69B68DBz8QzsdHPvM0H1w1k8eT8LvnNqjoPB7ohsCfWxsdizv0r8/FSlTK2UW0MHa8Y WvuQDQiK1VVEVajqnijCg+uMMRA9Rr4k1HhWhstdNgt06qh/U3OHcytFrbRjcJneMoXS +/Ww== X-Forwarded-Encrypted: i=1; AJvYcCXiAMpbR3JXErUW5IAxMs8rWzqk+Vcp8BLTb+OTrm3ftCWS0q+BRox/PgY5MRJ6my5mIQ2LitkaCNL7ZxOKr2Yq@lists.infradead.org X-Gm-Message-State: AOJu0YzUVjzawk8eMAS6psNVFJqoLvCmRwSDA8GLzJERO41jhJqTCPWE KLetlcm8oXpPb+pdOfKtyMR5+sQ52wICGRI99ew5EQwwFn1ncsKL X-Gm-Gg: ASbGncus+1jk163uUXZnmjjERN04i75cTxsbNEMQGEh+B7117RmI6QHzWjtdEXpZ11t s0e9QPRP5Q6l2I+8p9AfZKDRZCHPUspJ+atjnU9hFG8Pfl5SpOV322JdwoSwienHny8V2oi2gx6 Xk2OmSKm11Gezvr+33RVBuocM+ApJ4UpH3UifQWMlJD7/SDaDnnfDgAXaZ1Aii0lXaIay4HVNH0 6he9rpROEuxBVGzC4mrNdlOwQFN8DYCl2wgRvlXqv7ceR0cJErkOfQ9SG3sgTGIvSjSDF1r 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 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241122_141353_265440_3B859E46 X-CRM114-Status: GOOD ( 13.12 ) 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; }