Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10969159rwp; Fri, 21 Jul 2023 07:26:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlHgQEpkjH04n7WA6/lvSIfF/YzEgOJV03AIyVazowB6TE5x7y3B/i0Sr0qiZ+Tvtv6unxSD X-Received: by 2002:a05:6512:3142:b0:4fb:8f81:4fe8 with SMTP id s2-20020a056512314200b004fb8f814fe8mr1338873lfi.46.1689949575757; Fri, 21 Jul 2023 07:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689949575; cv=none; d=google.com; s=arc-20160816; b=lcWn90L3JYt6bs+/8rHdWb8FIOVWne2sFI859topLLEAZXBnK8q/CKP9s+iqDp9jc9 MNArDH30vtTBibu9A83j+m+wTREiD51GlbSCQ32UdY9cl1guwzeLcjXpl7hEoQJ6tdzw 9Vjphp8Jd/XjPUqyeTSXebdxKsW5+00w9avKZZohrEWYPg5gpt80RVJveY2fDOOIBOhD lYWsDSrPpvPu5VefixpOVYCBLRk7HHDleKgX13D1JSgi1SZqABV0lZ+AD7WIiM21Gaj6 HiUSo5U2kkIjrsZ/usLGp4R3K1JuwpXbQBuugunZo9djEsAJXq1agVK75+bUSTn7W4eE saMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dRBYGxiJV+fUO8L5x5OkCA3grJdrnxlxanjlGq4MKP4=; fh=9frbIG+5eKvNqELn2qUZ8UP3akRIGRm6w0alHg8xR8g=; b=CGx+L+rNg9mv4FDUNSTCHgw2E6b/soscjePLH7ynfZz092tn+yF4ikpvfR8nRczv0B SpXV15TzNFHt9IXsut7kpZBpS4SHRjHCnO6UQld3tIWk5OnNYOfJhdHOTxfXzpt6kgyU wTD8X7ghlSMgsLkXwKnFm0Bn+QkuEmcdZpFRtU9XMchG5OJun0yWMv2iqkIXBOKk7Aal T6f634s1523+1rLSG9sqbwgkFZoS0sM4wEEV7EhFCwSyMt7YViqFGne7fv0GZHEiV2Jx IiALGOzeRq9pZa7IWVrIkSDYhhSd5xAeI2EgMKHvWKZSnyHtdQhasTBdKECdUGjNNWOT H2wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=pfR7mREr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020a056402069300b0051e16fd4d9asi2339423edy.223.2023.07.21.07.25.35; Fri, 21 Jul 2023 07:26:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=pfR7mREr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231576AbjGUNuq (ORCPT + 99 others); Fri, 21 Jul 2023 09:50:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231556AbjGUNu2 (ORCPT ); Fri, 21 Jul 2023 09:50:28 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6FFE30C7 for ; Fri, 21 Jul 2023 06:50:21 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fbc5d5746cso17232905e9.2 for ; Fri, 21 Jul 2023 06:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1689947420; x=1690552220; 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=dRBYGxiJV+fUO8L5x5OkCA3grJdrnxlxanjlGq4MKP4=; b=pfR7mREr9aayrh+8f9nOd5qtIuFl435AvZJdQGv4nHPrajIcHM6UzskadI1FY3Jaxs NQS9yZsNmtZ22/yZjmm60KISaFO6zMnpY9KAevpevBTm4ZT4WNkfwH/P3qCRjmc8V9pX N1ff8VZXBWBZmIVdkVV0SBJH4slQeFxdXn09zAK+U12hTq9eShicztoNnxb3wLdWlp2N oCP5Zq610M8aEHl94yIKan/Lmk46W5ONk3k+hSSk3wwXqg9gLr3BGnLot2bedPF5OYtX TT760rAP4bbDEajDXH44a9AKHxRJfj7wzq337I1DRLVeYTf51pk7Jr8PCKH2TFu4igwA iN8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689947420; x=1690552220; 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=dRBYGxiJV+fUO8L5x5OkCA3grJdrnxlxanjlGq4MKP4=; b=cRs1IqoTYWqgFgk8EehBrmveFYIvb82ZkJ1Mj89uH2PlHde+MfSn642TgvPA1R2YX7 XVzWRMt5DE7NjgSOxFVRQeTSxdiyG3+DwJcZ/hGXBur00rksFyWQlTFyBzwIDjMaaeeM P4DLC/ZqK/CRLy4QwdQc8H9OyxiibBrksu8P5HSJ97tsO+h9Yh1JO4Imgp2ar3pM5Mg4 KBgt76MqsJ9CodRdbTZvWQjJt/VYDKV5JTEmtUcckrrbKYeKF67cQjJDA6fkrfZ9yEv/ IoEGiHvhlW6x10DJFCWAPcgI80xthQ6S9h4/IPZqFldUg4N1ApnAY/2pocnUAehqvGS4 nagg== X-Gm-Message-State: ABy/qLYMac+ULpQIF6S39Kb7MkYRmpEsHuteTR4c7Nnp2SRlmIafOAKO JKzlslM05EmezNaapXqd5Ix/qw== X-Received: by 2002:a05:600c:20c4:b0:3f4:d18f:b2fb with SMTP id y4-20020a05600c20c400b003f4d18fb2fbmr1623924wmm.8.1689947419766; Fri, 21 Jul 2023 06:50:19 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a247:82fa:b762:4f68:e1ed:5041]) by smtp.gmail.com with ESMTPSA id c14-20020adfed8e000000b00313e4d02be8sm4233980wro.55.2023.07.21.06.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 06:50:19 -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 v3 6/6] can: tcan4x5x: Add error messages in probe Date: Fri, 21 Jul 2023 15:50:09 +0200 Message-Id: <20230721135009.1120562-7-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230721135009.1120562-1-msp@baylibre.com> References: <20230721135009.1120562-1-msp@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 | 26 ++++++++++++++++++++------ 1 file changed, 20 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..60380b50e553 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,22 @@ 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 %d\n", ret); goto out_m_can_class_free_dev; + } ret = tcan4x5x_regmap_init(priv); - if (ret) + if (ret) { + dev_err(&spi->dev, "regmap init failed %d\n", 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 %d\n", ret); goto out_m_can_class_free_dev; + } version_info = tcan4x5x_find_version(priv); if (IS_ERR(version_info)) { @@ -438,16 +446,22 @@ 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 %d\n", ret); goto out_power; + } ret = tcan4x5x_init(mcan_class); - if (ret) + if (ret) { + dev_err(&spi->dev, "tcan initialization failed %d\n", ret); goto out_power; + } ret = m_can_class_register(mcan_class); - if (ret) + if (ret) { + dev_err(&spi->dev, "Failed registering m_can device %d\n", ret); goto out_power; + } netdev_info(mcan_class->net, "TCAN4X5X successfully initialized.\n"); return 0; -- 2.40.1