linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: m_can: Add check for devm_clk_get
@ 2022-11-23  6:36 Jiasheng Jiang
  2022-11-24 14:44 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2022-11-23  6:36 UTC (permalink / raw)
  To: rcsekar, wg, mkl, davem, edumazet, kuba, pabeni
  Cc: linux-can, netdev, linux-kernel, Jiasheng Jiang

Since the devm_clk_get may return error,
it should be better to add check for the cdev->hclk,
as same as cdev->cclk.

Fixes: f524f829b75a ("can: m_can: Create a m_can platform framework")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/net/can/m_can/m_can.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 00d11e95fd98..e5575d2755e4 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1909,7 +1909,7 @@ int m_can_class_get_clocks(struct m_can_classdev *cdev)
 	cdev->hclk = devm_clk_get(cdev->dev, "hclk");
 	cdev->cclk = devm_clk_get(cdev->dev, "cclk");
 
-	if (IS_ERR(cdev->cclk)) {
+	if (IS_ERR(cdev->hclk) || IS_ERR(cdev->cclk)) {
 		dev_err(cdev->dev, "no clock found\n");
 		ret = -ENODEV;
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] can: m_can: Add check for devm_clk_get
  2022-11-23  6:36 [PATCH] can: m_can: Add check for devm_clk_get Jiasheng Jiang
@ 2022-11-24 14:44 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2022-11-24 14:44 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: rcsekar, wg, davem, edumazet, kuba, pabeni, linux-can, netdev,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 619 bytes --]

On 23.11.2022 14:36:51, Jiasheng Jiang wrote:
> Since the devm_clk_get may return error,
> it should be better to add check for the cdev->hclk,
> as same as cdev->cclk.
> 
> Fixes: f524f829b75a ("can: m_can: Create a m_can platform framework")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Applied to linux-can.

Thanks,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-24 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23  6:36 [PATCH] can: m_can: Add check for devm_clk_get Jiasheng Jiang
2022-11-24 14:44 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).