From patchwork Fri Jul 21 13:50:09 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: 123894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp233096vqg; Fri, 21 Jul 2023 07:11:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlGNneYqEA2HdIU2Wc5tlzxmAvReJIiVr5BTaxsaFkTSvKmDXXPmoAYeJ3L7fjgqZRU+P2ht X-Received: by 2002:a05:6e02:1314:b0:345:b536:61f with SMTP id g20-20020a056e02131400b00345b536061fmr49515ilr.31.1689948689551; Fri, 21 Jul 2023 07:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689948689; cv=none; d=google.com; s=arc-20160816; b=MxZB5tYVUdx2GhOfebpHf36wC14PYqxFBEcq/WLQvySLVe4Zays4tpPHo5s4PnFTQH IHtxxnjoWSBSPxUUmTgFm+G4m3QDwO/c62u8uBcxdrt5THY0CkJWg9DpJTl3ZtV2qage jYkOIGme2KjkERthYLq74/KmCMj/W7fNMjZJyaojkn0nzMXDCxJdFObcDL+g4gvOZuFR /Nei0CwYlvwtL/1brOyzOmfL2gQfJh/lctRhl8eCqf/OXi4WXibUqSS0WVx/QEJty5bv M1QJLGPGU9FcnH0YX7KWDOv2iT1rVXlg/FWWS1P/ywF62Z5bsiO5T5fktIckyj6c6Zda EOdA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v24-20020a63f218000000b0055af0729456si3009979pgh.399.2023.07.21.07.11.07; Fri, 21 Jul 2023 07:11:29 -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 S231633AbjGUNur (ORCPT + 99 others); Fri, 21 Jul 2023 09:50:47 -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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772039637191036639 X-GMAIL-MSGID: 1772039637191036639 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;