From patchwork Fri Nov 22 19:53:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 845492 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (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 41874175A5; Fri, 22 Nov 2024 19:53:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732305209; cv=none; b=srHLpkQDtH2iBPEF7Bq7D6Ouc8JONPyc/q0MDs/835yfpOeWxZVsrL/RK2XmtFQDGflAlrBr6q7dhNAqTBvfwjGCgA5XOsRod5damJUte/f0oryxgAiuCCJuam1k4mAAASXZlVIrCmZureKAkFSnRBCvII/GqAX7u0iHZpEVyYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732305209; c=relaxed/simple; bh=ZZtZHYA/IIm7LQvrI19Jp2brzd9znJvddYJCiGGW06I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J1/8bQsLLdASTFxc+svORW7qCDxp1BW6LBjdBVh7A5ybREa0bUJdAeG44fNK8NECCHSnNY/7GVyzhq26o9pRvf8QdA5uYbtZGIeMoCHXVKiRtWe/TWFkjPl/qSiqiQSJGJA2W7T/Ba/FDjgn05EeuKuva33AAYXrbyQnzq4Okzs= 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=erJsjfeW; arc=none smtp.client-ip=209.85.160.174 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="erJsjfeW" Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-460af1a1154so15160271cf.0; Fri, 22 Nov 2024 11:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732305207; x=1732910007; 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=CF/HRhep9JBi7dLu2TPvpQtWrqcbCsu76aTE4DvPvS8=; b=erJsjfeWCI3E9eT0RVkPjQigloK8SHDDZXFmo8hY0YdbcWs+pJduuWvXr3MCcy/W2/ ehhl1LpJlgLf4+oi+/6xJXNYZRtPVze2fDPNSvU1W8P8rdPCQiHh1i16Goiz8i4+r5Ox gGYFW96dQuHhBSrtVFKGpwj1vyVCcQVTfyTaAZFwrw/nXfoUMezX2z3oriBn4UeuLobF VH58SIkMg2eSrG/F/INn/IjTTToeZhJOozSEjqUgM/q7BRfR3NNNC6OABDoCrTkgVnE3 FQMvs6Jbz2shjEgjxIOllWoXnVhc7TKtaYoPsxnl5CN6qHTnKN0iNnmYnshykpxFlFtQ StQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732305207; x=1732910007; 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=CF/HRhep9JBi7dLu2TPvpQtWrqcbCsu76aTE4DvPvS8=; b=KKf7PFAVwZCovCiIGEmDOialMN9bK41THXj3omw8a+ecOYGjeY1rVDaolmXKQGcPgQ jg3kKf4p9UDy0w5Xt31FBKX0TCy7pfFEYOQ/PvCnDxIXzXQyorLnOjlPHuTKpj/33wi2 pgBXl8eC+fGY+80l9Dyts7qQ7xAH/5BcTURVNdBoOvnCZ13Xb3RVxM3/GQo8TC0RERiP pMtjp1S0fB54wa8s1d8qwtvuxGCd7oBXk9H7fw//EfTLysBE3onVT7GN2n3Me+OfvFz2 2b2aoKfg+rQz1ZjS69ep67wL3H+JvCKR+qc/kqjtw7bJlstrIyPp6wji7UpCHv54ICHw 9aFQ== X-Forwarded-Encrypted: i=1; AJvYcCUm1jqM9zYn6kziX7S8Abg/0jqDbngSUM6WjjE8ks5dpeHYW/8jMBiq1eRkdLaPqRj+BzzGyEm7YtFa8v0=@vger.kernel.org, AJvYcCWxamZ8atHkzaGt0e7OR6TGcJXBHoLrSKufdRffNCFzkRtaDsxTt5OrNK52OukNDTh7KfcJWsS5IUS1gA6ZIm1xwfs=@vger.kernel.org, AJvYcCXyzfBjnAAVa+G1gdNpOLu857RzjwuTI0Sl2JmxFdWq6gnsO2m17rrQ2rShVg2vsBU3zr3rx4MMPxw1XpA=@vger.kernel.org X-Gm-Message-State: AOJu0YwC6OzqGnp7AWVedJws1nLaQ+eXH/ri9rv1C7pnPdDkS0v1RrGj rO0cCL6B0f3LaJ+90tdtPqPV6ruJCoPhALpeBXxAI83XnQ2ZdjXA X-Gm-Gg: ASbGncvbnQuRuyTMv1aozwSqQUhHOOP3uryd1VNJv6XGZKMdEKwBhmqqz9XU9h4IJQI 1IyoD3UQHY+amPAGQRwCGz6NZ++LaUyuugWIdFVr2o97P3C7AsWAZKPgiUe3WyrTJF4oJjeMGkb FMvfUr556HZLyR1VqSd452WikDBJsopDGafs27O32CqJsbTQWSbFbTLoluZUlQvzw+1ZfUTaQNa TF046sdK1MjuL/RyDpbeuAmuQwWzqbF0wSTlkdLixa/oOmCRb8EJcph+avXA3/T1O+s8hav X-Google-Smtp-Source: AGHT+IGWS/TRquPL6ThkLaNpCv/OoH1M5+ix8LlZG/vqWDvFWeRjvAxoJJc+WnPkQLUTQ/pMdaugqA== X-Received: by 2002:a05:622a:5c98:b0:462:ac16:e72f with SMTP id d75a77b69052e-4653d5302ecmr60216091cf.8.1732305207048; Fri, 22 Nov 2024 11:53:27 -0800 (PST) Received: from newman.cs.purdue.edu ([128.10.127.250]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4653c3ee8cesm15535781cf.25.2024.11.22.11.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 11:53: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 v2 1/2] media: mipi-csis: Add check for clk_enable() Date: Fri, 22 Nov 2024 19:53:22 +0000 Message-Id: <20241122195322.42289-2-jiashengjiangcool@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241122195322.42289-1-jiashengjiangcool@gmail.com> References: <20241122195322.42289-1-jiashengjiangcool@gmail.com> Precedence: bulk X-Mailing-List: linux-media@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. 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..47b8e043aae9 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 19:53:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 844995 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (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 8B0402FC23; Fri, 22 Nov 2024 19:53:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732305210; cv=none; b=p5JLov1eqRjmeRTJSjLStgc1tbMjbNsDdtk/T63nujRvwcIovdd0S7jDnB94c1kJWwnK7ErZldu9zZQJfn9Ygqusb3kuSoSjZFLucem/i1UcyTDd/Q0XkbQDmeJhhC+D4VeFJNP28RZz80+IVK3894uN2JK4qwrfN2ssi4EYeHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732305210; c=relaxed/simple; bh=E/5sdOL/jkUCbV3WEL3b/0KOfVk/fXbHHdo2d90g7Q4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=dxGyTGK1HqQHHJ/qwiVLAmyvdPDDtKT6YAi/ighixBHBGjDab01UncI8I9Pknl0AkUX42uDOGR541GUicbjL+ODarwJbYI3n+/b26gR4XPiVlW5EXVDCCAE+Nz3DUjYXhqc91HHw3YJii0M9Cs3Slss1uzFdYdSBP0OBuC16z3s= 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=XV/6I1Bz; arc=none smtp.client-ip=209.85.161.49 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="XV/6I1Bz" Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5ebc0e13d25so1027718eaf.1; Fri, 22 Nov 2024 11:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732305205; x=1732910005; 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=XV/6I1BzwMNqJk+WhlPtMTNM9pPiza1iqOqvHrsxXNm4rIdO1ldhpdrlraAJhO9CD1 sKO+J+qLh2CcN6RrRvqxau2N9QGioTUjQivYoJWFnzF9+NZtOl7f0aPkcRbbPX4qwCdA IsIEkvlwyzs590VNY1NuBaOa4lx4EuUiNCfcadmLd5PPsGdrpFRJtoPmf4DQaGDwCXZM V+Q8fGaIDsV2QCgrcIjeAPNotz8Vpd6mgQrGFPAc+BB2boV1Yzv93Mbx0KQDf/qofCad i0206LSTQx5lrJz5Rg1mzjcIL9ooX/j0KvxPd9mQqCr4YR+YhqPpgsfX10OhiRxFku0C 5fwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732305205; x=1732910005; 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=cY19Pebqpk42QgVnOtFRIRh9owQWHSJ4I/D5lfVioGBR6caWlZMDIJGdOqGKpouBSk 2e+00ZIk9ozb0v8yqxris1PHSCLnJg9k5v8N7561AyDVEBnj7vM5GEkTtOynDBGgi8kD ZvbqBVF2lg7vJtKcL9aUl0poGi4AVcduyodglt36pD9HgH+RqBIqGm4cIuqSi1lj0+C+ wfBH1KgwgQDnXWLU8BMPSkL1rKW2qsOm/UfGo0kXYnrZmk2zH2SjFhog2nSKDd8MFY0L ixGT4zRiLCDcfVu7h0Iz+ssllGVSnjR6qjI7QFxM+Rp741n20Jp8yxY+qxV413TEoBPX EoAw== X-Forwarded-Encrypted: i=1; AJvYcCUCSWTwS6/UFEia8857L+mtk1WVxrqH0iAF69kuLqO6i/1ap3193/px1OezzeJ3FdwdcgTbnjvop6zS9vVatKfbRnw=@vger.kernel.org, AJvYcCWeP63/BqScBbRoE+I/b1BKaSRQ+emrJWVjudLn9jNeBli4xD3/G9doUCsuudUwcG22rej9G2wx/ENG/nA=@vger.kernel.org, AJvYcCXTaBgMV/CuvcSO2xNth2ZK6P/ceSbIFG2xzobizz/P8Bmuiu7gwZrBN9k2yhr+o2/7+PXGzdh2JVsxGFQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/rCLeOFJIXMv4MDg+PzImRUB6309B1HSBNbA+/BWPREIL8GoS 4ehDbWiq6oNmYX5evJ/9yOCHo0L2ogHNkEm+HXnEBmpwpUhP7TyI X-Gm-Gg: ASbGncvFUeFKmXhNI7OYqRdomzPJ1Bg1YSi3SslSIgYYrbCA3NWFT5/DjdX/ued1gE5 MZQHNCnBvhILMizdrvuE8m0xB4RQbFPkyLwPnZATqv5L70ST9DRT6Y4Gn9qUfxSompuIeUyMQLh 4+5qKT5K8K4CiZlshIwV86JioLXBXq2VzsEh3bYFKZ4aSGt7E+mLPkG7aYPnaGxAUIA4H0fvQsh 6fFPrGj82nk8PYUD4Kk8NSh2KBAw4xamTaVtrg6Vp8PTBUduiPnzpG2+QUQ+QKv8dErt4SU X-Google-Smtp-Source: AGHT+IGG9LZL6Q/86WX74N5XZj9qYPlo3OR250a6F4l7/ScFyw2yctiaAwQR6Ax+KIbBRfxQwQ330Q== X-Received: by 2002:a05:6358:42a0:b0:1c3:7b75:24ec with SMTP id e5c5f4694b2df-1ca7977c9a1mr446366855d.15.1732305205386; Fri, 22 Nov 2024 11:53:25 -0800 (PST) Received: from newman.cs.purdue.edu ([128.10.127.250]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4653c3ee8cesm15535781cf.25.2024.11.22.11.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 11:53:25 -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 19:53:21 +0000 Message-Id: <20241122195322.42289-1-jiashengjiangcool@gmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-media@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; }