From patchwork Fri Jul 28 14:19:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 707654 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BD2FC001E0 for ; Fri, 28 Jul 2023 14:19:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237066AbjG1OTw (ORCPT ); Fri, 28 Jul 2023 10:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236992AbjG1OTg (ORCPT ); Fri, 28 Jul 2023 10:19:36 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B25B3C2A for ; Fri, 28 Jul 2023 07:19:33 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3175d5ca8dbso2077940f8f.2 for ; Fri, 28 Jul 2023 07:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1690553972; x=1691158772; 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=giuTVJOpvmU1j6SJtXvrs5HolX4CC90ajhkJHQ0pjgw=; b=GrtnL7/fM1SgKRl6fxfIk1pgHVZc0FLNnQTNXNMpxFHXajx2rXR3OjONZAlZAyreCW wS0ZA56RjkbAQzV8dIXlnRLIgoKTDUHRohsAmJAfzMuVkjr5Eksf9+y24egs7pWkz1Lt t6aWo+pYRTaeAVlx7aJyRoDnL18L8ci+c0IkUlTPPt30Grj5WLBSNu/++YOtqK/AV7FR 9AujkEv8QZrtBVNklyS4rjjO33pUWkVGZt9xTwemXM3VcFrc2pmM0EiFIJ173U7bccTe df3kQRxZyHLxaduu/v6G27VyPG8qfOPqqqKdg5koRtkWD54WPU55vPL1pHXtI8X+BVMr W/bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690553972; x=1691158772; 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=giuTVJOpvmU1j6SJtXvrs5HolX4CC90ajhkJHQ0pjgw=; b=ium6YJzraRMYmG7obf7rI0/n738tuXSbTziDDzG9BgrxS3s4vjPP8jVNpZSk93ABJP ihooC+a7/MnMcBCGR2bmaqT+oWPKxC0s4XS/lwh4dDmr13vo+zECpVNNZEkglJe5Yhu3 kQNIYGGQlWoY2hu0u4PhcrYAN/M/Bz2EKi84F56MRAWs+ZjC3WiXHD/vNUOi+baYuEWe H2xZOBoV/eTo4W2O9VaCsAV+zeA81jaMa/pNWqC+8Y03FPO8MMpGdusoahyZwdC9vWct LMuVS43j0gUBsGXmcIyKG92y4WuZUeWjJAa+reN6uCpBpYan0J5NWd6/F6ytN9aHJNYL cLqA== X-Gm-Message-State: ABy/qLaCeZNN4uKhA97eoC7hrZ383FeFWQZdkQOTYtqWHy7YPob5ul7X CN79tfQPJnjPwCOElAlL6EHJjQ== X-Google-Smtp-Source: APBJJlEjiAZn1StP/CczL78boawHSDHTP+/5VlogrBFTZtZZTRb0ONZC3/06apTOOVB9xk0UI4TTYg== X-Received: by 2002:a5d:6849:0:b0:313:f347:eea0 with SMTP id o9-20020a5d6849000000b00313f347eea0mr1951153wrw.60.1690553971785; Fri, 28 Jul 2023 07:19:31 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4090:a246:80e3:766f:be78:d79a:8686]) by smtp.gmail.com with ESMTPSA id l6-20020adfe586000000b0031416362e23sm5013681wrm.3.2023.07.28.07.19.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 07:19:31 -0700 (PDT) From: Markus Schneider-Pargmann To: Wolfgang Grandegger , Marc Kleine-Budde , Rob Herring , Krzysztof Kozlowski Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Conor Dooley , Chandrasekar Ramakrishnan , Michal Kubiak , Vivek Yadav , linux-can@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Markus Schneider-Pargmann Subject: [PATCH v4 6/6] can: tcan4x5x: Add error messages in probe Date: Fri, 28 Jul 2023 16:19:23 +0200 Message-Id: <20230728141923.162477-7-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230728141923.162477-1-msp@baylibre.com> References: <20230728141923.162477-1-msp@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org To be able to understand issues during probe easier, add error messages if something fails. Signed-off-by: Markus Schneider-Pargmann --- drivers/net/can/m_can/tcan4x5x-core.c | 29 +++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c index 2d329b4e4f52..8a4143809d33 100644 --- a/drivers/net/can/m_can/tcan4x5x-core.c +++ b/drivers/net/can/m_can/tcan4x5x-core.c @@ -402,6 +402,8 @@ static int tcan4x5x_can_probe(struct spi_device *spi) /* Sanity check */ if (freq < 20000000 || freq > TCAN4X5X_EXT_CLK_DEF) { + dev_err(&spi->dev, "Clock frequency is out of supported range %d\n", + freq); ret = -ERANGE; goto out_m_can_class_free_dev; } @@ -420,16 +422,23 @@ static int tcan4x5x_can_probe(struct spi_device *spi) /* Configure the SPI bus */ spi->bits_per_word = 8; ret = spi_setup(spi); - if (ret) + if (ret) { + dev_err(&spi->dev, "SPI setup failed %pe\n", ERR_PTR(ret)); goto out_m_can_class_free_dev; + } ret = tcan4x5x_regmap_init(priv); - if (ret) + if (ret) { + dev_err(&spi->dev, "regmap init failed %pe\n", ERR_PTR(ret)); goto out_m_can_class_free_dev; + } ret = tcan4x5x_power_enable(priv->power, 1); - if (ret) + if (ret) { + dev_err(&spi->dev, "Enabling regulator failed %pe\n", + ERR_PTR(ret)); goto out_m_can_class_free_dev; + } version_info = tcan4x5x_find_version(priv); if (IS_ERR(version_info)) { @@ -438,16 +447,24 @@ static int tcan4x5x_can_probe(struct spi_device *spi) } ret = tcan4x5x_get_gpios(mcan_class, version_info); - if (ret) + if (ret) { + dev_err(&spi->dev, "Getting gpios failed %pe\n", ERR_PTR(ret)); goto out_power; + } ret = tcan4x5x_init(mcan_class); - if (ret) + if (ret) { + dev_err(&spi->dev, "tcan initialization failed %pe\n", + ERR_PTR(ret)); goto out_power; + } ret = m_can_class_register(mcan_class); - if (ret) + if (ret) { + dev_err(&spi->dev, "Failed registering m_can device %pe\n", + ERR_PTR(ret)); goto out_power; + } netdev_info(mcan_class->net, "TCAN4X5X successfully initialized.\n"); return 0;