From patchwork Mon Nov 25 19:18:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 845519 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (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 51B8538DE1; Mon, 25 Nov 2024 19:18:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732562305; cv=none; b=AO02QFW2CXoYuJ04Z+b3NJEoO9jHZSDkJKs1bMJcyj00C9rtg3YBy1d3k4rb8z2G5Omxne0n/ZJLsDP72hp9JZ67fVTlTm/RrIIJPChV4+nMHHc2FCz2fHpVC3Y9dWOfBFzCBj0EgoK05vDd6MMz9dGTj5P5fbhDzBtZXsQ6AiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732562305; c=relaxed/simple; bh=S9lNBdOz+fyWtttvxwI71Sb5SqCDucavC8LeLhcrfS0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Tke42WSuE2fgUlUXZH6/HzHdJgL1UNbjAwPc++dMBb6G4Ar7lzhgWcAMrQv7+Y4WIF3z2rXMBupwJMFu+besS7UNd/DhAf/yRFTkN54T7OWGAfaVSi4cXyUPTFPqF4nUS/atOrOIwGTroZHiJoJVbGnqqlu54q+BwQ2nDklWnSQ= 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=TJ89HJ8E; arc=none smtp.client-ip=209.85.160.169 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="TJ89HJ8E" Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-4669eecd88dso5135411cf.0; Mon, 25 Nov 2024 11:18:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732562303; x=1733167103; 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=TJ89HJ8EX9B2XOMrmq0Ff8guHbI8M/9LqX4XtBSIvy4SyrbbYCXZXx+jmyBXqbMYMG nqksR2+JrNzqgUfE96q6l3strOkvMd+Wi5uolshQCYXQFGxlj/xyUNOENhjBfnUL9VxO YJRQAkf2HqSTqJ0qWEYD8/U+EuE8m3Vx6ymJkPQAOd9hZV/YGOh50ptFWlBgqTyBiqmw Sgao0+2lgfibdFugH9WAJCt/aAofONwsSTLGzYDb/FzgOVE09DI1k4RHD9OwHg/W7xrC UaqyLJqVCPcWa0IHAdu2ZA33/nnkelTIhp7qQXnLGXGD1necC6YkzH9i3D3vV/IZQBqY D1sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732562303; x=1733167103; 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=tLfcD9fuK43PUUOI3p5Zyns6m3rwxrTNiIPVfkFKqXHD8TqbgWGNAy3tdIq7P5GhTX u9uB4mazshwOxNLKhwD7IG8QljRCN3HG6lC5KQABuisvFB2yI67KaaTMgCMx5TL7rxiq +Xqitct1OY1zDBmwt2SfB1q3Dii7ZEiYJ7gnHTxpW1lsQ00UeSk/FgR2XK8hlA/wtQoX pvr/hMCrh/EYhryhJaXbtM5xkYvfpdkqwlPV/PUI0aET/g6EepJg9g+xLH9H22fD7U0u FUQdIYjWSKp/EFAIYcd2lKDHkYA4nD/ktOE83DC4EYqxZX8VX7+YIw+NitlaH8fyGLbB DhMw== X-Forwarded-Encrypted: i=1; AJvYcCUYnNeXjlMfn2oKkdT5DjWA48qpY7IgYF8HfFNCLCvHpp7ZmkSkdTeG4rKdVORhVgprrtJott6DcR+/Hg0=@vger.kernel.org, AJvYcCViex+1KR6EilUcvrRV3n/IA4PJDYig0VfsBm7/sxqgyH393suLdfVDTO6hfnS1LAcTK7MWkk6GMhaCo1wg4Js5XYQ=@vger.kernel.org, AJvYcCW6qG2NTpc565+Tau+DGs4ZcDU4xsTfbZGdWDjcVvvcl2HAo8AmGBH4Svki9x1Gr7BW+LCO0AnlPK2IQhI=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4O0zTNsBvdXxLTKn3iGj84H0479VusteOe/BJHNLIIQbDxoor BsoMzFcTutU7hYXcSRUvcZWD4tYusUOBpdY97aWIRQXqxbv6qoBx X-Gm-Gg: ASbGnctUV228d5IQpE7tDIcVhzELpjgqcmO1+AH3rJ2ow47V70X/pg1WA8PsmKt1U9L tNvDw3GmKDQ9TSv0x7JG1z4JCUpf82+XrACUDq16vedLCH/0TLnB7EVojIY9aiTYC4ZEsaQR37B cYZifG4ZCfjJw+63J+2tw6vEXyeyGJH8jmi54Vh/WRc9tcXz1Bw5Nd7YVENbfJ3ieQBn33RwLqu /ano7YMA66zTwVM2TUe9Qju9mC0NR/8FEDT7qxXs+wHghUW8gxjzVMa5kk7wDR1WkO2V4nN X-Google-Smtp-Source: AGHT+IG58OQhLBaPrhh2bJX4k9J0UG4UvxEIeq3Wd/sphHg+BCvjNpTkmqCSn1tq3goDjKzewrs4qw== X-Received: by 2002:a05:622a:41:b0:458:2b7b:c45c with SMTP id d75a77b69052e-4653d6280c6mr235109651cf.39.1732562303245; Mon, 25 Nov 2024 11:18:23 -0800 (PST) Received: from newman.cs.purdue.edu ([128.10.127.250]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-466a41010dcsm1193741cf.23.2024.11.25.11.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2024 11:18:23 -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: Mon, 25 Nov 2024 19:18:18 +0000 Message-Id: <20241125191818.30708-2-jiashengjiangcool@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241125191818.30708-1-jiashengjiangcool@gmail.com> References: <20241125191818.30708-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 Reviewed-by: Krzysztof Kozlowski --- 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 Mon Nov 25 19:18:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 845899 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (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 F3D9B2F2D; Mon, 25 Nov 2024 19:18:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732562304; cv=none; b=TXSjwsuSGFi2NLE6bvfIRPEfxbD506ZJBIEr3/VOB49DSyBBYMYupQikVtIYL7wfzA7pIsMxg6M2Tc6PxEibAT3oWYUpGfKgeRsbOks5wNA/TgG87yPQMeHCDf+Ojt5SYHYvQlohVB3ZjBGipihiXza/8s360rKZsYSBd5GUNPk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732562304; c=relaxed/simple; bh=KqpcSL5ZK9Ifr+2efgOUwaGAxAAr+m2ijMVHHU3Xj3Y=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=jYb5mPgETHsLY5LzYKmN8ycNAPHLqAc48T+xt3bzzruQ1qtgv6dVNIgpp+mt7GNH3p8KWWfL05fNZQ8NCmGEgEsVo74qMNQleMuSA07x1Kgn1lv9z+128Tp/LVti9l9QmZ9BVU8Kv9nnzeaBVdzNu0N46ITKWB/xmLR5ylTLsDA= 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=PpHgpsG/; arc=none smtp.client-ip=209.85.160.169 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="PpHgpsG/" Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-466966d8dbaso7497741cf.3; Mon, 25 Nov 2024 11:18:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732562302; x=1733167102; 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=wAHMSsIO5ddeQOx4lVtN+I8avLKmTpynXtfS6IHjzgE=; b=PpHgpsG/6qkEe20Y6V6lWSANVzTe8O+JDsvJHYz3IfhX1vE872JqgE0oa+OXPqETp5 vR2fAbEU/ziHu5kZy44WNyH/fYkYFBLVa8rnl1xr13Dnhd9Moud/RsTX+gbFaVFMAS7L zvB+igw4ZJX4ecje+1tsfEL/KFPAVwkN7t5fI1vE2VElnHEkUDtVfNGnU2smyz4qIfIH Mk6Mz5GVByAiAusmEldcHSPLaeNGASvltwTFfYf3iY3ElNW8llaJuvLv83J9MLHSiIL1 uROKjZgL9xRfKwM5Tj8d9W8eQwdnb4Hu/+cz3aYFAhKUCRgWWp35hHiuK/9elKd9XC96 00TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732562302; x=1733167102; 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=wAHMSsIO5ddeQOx4lVtN+I8avLKmTpynXtfS6IHjzgE=; b=t79BC51tV39TQfdfX4vAP+u2xUjfVOWPpn+wenq6qJR6JVrJQlkLMdWZzlwfDf6hnj Tf3OMX6ZE0H3QPLthQJdwSrRWx7dL0h7IBDzHDwco8lQd5PtO1pONHQRaSa/usbBNznQ 4NfUqcqKoFRpfrdD8iqhKjV2zgdBZlEwYwQm6wNKH+42vdDqE76YUROQgDUbws7rUmlE t8IrlxRsqMB4PRTWjhR1BGUmz+dfsb0s7DZSmaJCXVJrju75wV/ts20d15a+pWty/MgP 1nqX4c0Dx5u+zN0LWE/R+y8pgMFoXbRRksiRr6GX69wJ+B7p4W8p3cXIntHBIqKcV8EY rUrQ== X-Forwarded-Encrypted: i=1; AJvYcCUWlrrvZ4FyPRfgxtnP8w1HCrMjW36vMzylHl4dLsnDQliomPpzvL1sgele9TXnOrynbo0RwDUspTnVk5BVF9LI2K8=@vger.kernel.org, AJvYcCV0wgDyZC6XVZ4/dmwVBeo69znTCzS5r+Jb3PuNT94ysbbrMQlL1A3dJWVFIkfJf6Mixm4iHOWZDGyvEig=@vger.kernel.org, AJvYcCX3vR17ua9BiWU8ocSKw8LoAliJ/BO2C0PsKRxDJemCJI4IQlHwSOVsGrNRSNi9nyx/fAheBpXnlFVqsco=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4SFqEpNkhZb7ycpr2toqnNw8bDabKAt/IAtMK1SmYePHACWdn X1N6wK/jiDRS/zxnMD9Eu4oFx4cCPguZA3kzXMVRmwk3O1ostiVk X-Gm-Gg: ASbGncs9IxDKvysCAkcA6HRarkx7ebsOgTFVK87FnGPlqw06InoKoSoOcBVQELzehQ0 uEWesnz6zw4ilvvIAQ+qQ0UlmPD9BHdctikNh0a9a0DRIkh2AcFH4ps/yBgg8dpWBK2aG+TXHhL 8bmoWN7LE8Y22Gtcwo7tINw+b7+cfc3iXPREz66PY84Wq0XB/OGeWpO3EHcmdC04JaEXa3fSiSG jeQSfMIauTGcu3zvNL5SJnyJER4cTjWtMZ1iXfgNtyTyYx87cWQRQxD1TG3lmCFp0l9Hvcp X-Google-Smtp-Source: AGHT+IGTeVRK8dnEv8pLZMHBWIn9oa+b5th9cKFLAQnuxR7nxKyS8JQjQJzxVPrI1VwR4PTpAiDRDQ== X-Received: by 2002:a05:622a:1817:b0:460:90aa:ba8e with SMTP id d75a77b69052e-4653d63ec53mr203814251cf.52.1732562301606; Mon, 25 Nov 2024 11:18:21 -0800 (PST) Received: from newman.cs.purdue.edu ([128.10.127.250]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-466a41010dcsm1193741cf.23.2024.11.25.11.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2024 11:18:21 -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 2/2] media: camif-core: Add check for clk_enable() Date: Mon, 25 Nov 2024 19:18:17 +0000 Message-Id: <20241125191818.30708-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 Reviewed-by: Krzysztof Kozlowski --- Changelog: v2 -> v3: 1. No change v1 -> v2: 1. No change --- .../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; }