From patchwork Thu Dec 29 13:31:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 37392 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2402828wrt; Thu, 29 Dec 2022 05:33:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXul8/7qgee8ZQvGE4dhw1eaaWeUZtRikbHXSBDMTfcHxtp/rr4eeMyw/3/39LqWEdDPT8j0 X-Received: by 2002:a17:902:b401:b0:189:aa51:e27f with SMTP id x1-20020a170902b40100b00189aa51e27fmr35910663plr.44.1672320825288; Thu, 29 Dec 2022 05:33:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672320825; cv=none; d=google.com; s=arc-20160816; b=LFAyPVkpKnVYD+nIHBIw+5t7LlVLu8rB/cK39j/aOiyB8ni25OsW4CBIu5P3U9GWf8 GuMpGB8KYPvNjnjfUr7+20m1tT1hR3XNe20LhvKVsUBlU9FA/gNRVzJShwgNyqzil8rL AhbjK+8/ELYqbYirk+2oz3CpKzZK3jYcSRuSxPuEz7nngirRxpBxhwZ3LpY54wnxFrjz r3Z1/rSDJlQs4ospAH2d0FVI45sG7jQnoAitOa+XDvauOE+c4W2YPY7af+IS/NA+vcy1 8W5RjMV1WHtBgZC+JWo3VNiq8Kn/pn56Lp9S08bmuxvpdl7aaqyYoczVqQ37ksmNeIz2 +0ag== 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=lxGIJCef9c0twbq/D4ksS34yk0nVt24wbkjICVr+NEc=; b=xUBTVHN+AlM5o4JNSZWAZ1PnOWrL6xP5QgXGVk+7pqYddCq88qCSY7dO9xmL+VSsOH KbucF6iA7g9Kpg7lzFh5AVO07wnBVmvDIqwjlX/4UworQ+IKLVsxphPK4LqxSPYuFT0t UXYvd9wXfn3xFiz+9pcnN38n0DfDEO3z37L1ZbFRgi3P9uqJ9rMZ9DVg5HjVOVNKca6p mtjEUT64jd0eOuAG/FAy2MIjLnrnVMaYtDznMPoRgGBeEZ/Z/vqDJX3t6X46PcaYw6bL g1UhHiGVOT+Kdmwz+uWeUTj5drc9JBLDRohfdSsA7ycc1phkAsfOIcMUiK4Aq7bkNwuq lyYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=SG3KV1fV; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a170902c94200b0019294cce398si4931199pla.314.2022.12.29.05.33.32; Thu, 29 Dec 2022 05:33:45 -0800 (PST) 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=@bootlin.com header.s=gm1 header.b=SG3KV1fV; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233504AbiL2NdM (ORCPT + 99 others); Thu, 29 Dec 2022 08:33:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233382AbiL2Nch (ORCPT ); Thu, 29 Dec 2022 08:32:37 -0500 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 504C310FC7; Thu, 29 Dec 2022 05:32:35 -0800 (PST) Received: from booty.fritz.box (unknown [77.244.183.192]) (Authenticated sender: luca.ceresoli@bootlin.com) by mail.gandi.net (Postfix) with ESMTPA id 22963FF810; Thu, 29 Dec 2022 13:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1672320754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lxGIJCef9c0twbq/D4ksS34yk0nVt24wbkjICVr+NEc=; b=SG3KV1fVDNj7ijnQf7DjsPLWGdQNLQJ9QsZHfvRKpIiQLNxnrm8ZBK6eBeqX71Y0CTWwQC DOjboBANQ9XeA2Iw2AFaWFDZrwZLpDzl3TeANGWMBCvhGWOvAbtV2xZY2gS/8Ur9vhG/+m WDfo+85JinfsXhooviBIv95oZuSV7X5qvO2N1z50QO7BTfjH9JSUlycXD1doJ8OWHw8TEw vrzLMIf87wmDHKu6YpgFB9d832tbM7UTUsl6jFAceD9R9FqBvQgfhX06jw8OyZETLUQEaf 1lc82Kg1m+ur0RobyjLWAa3I8idQhtufehYoDiZARh5yjvmNgj9sS26Z3lQUEQ== From: Luca Ceresoli To: Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Mauro Carvalho Chehab , Greg Kroah-Hartman , Dmitry Osipenko , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Thomas Petazzoni , Paul Kocialkowski , Richard Leitner Subject: [PATCH v3 07/21] staging: media: tegra-video: improve error messages Date: Thu, 29 Dec 2022 14:31:51 +0100 Message-Id: <20221229133205.981397-8-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221229133205.981397-1-luca.ceresoli@bootlin.com> References: <20221229133205.981397-1-luca.ceresoli@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753555481572985877?= X-GMAIL-MSGID: =?utf-8?q?1753555481572985877?= tegra_vi_channels_alloc() can primarily fail for two reasons: 1. "ports" node not found 2. port_num > vi->soc->vi_max_channels Case 1 prints nothing, case 2 has a dev_err(). The caller [tegra_vi_init()] has a generic dev_err() on any failure. This mean that in case 2 we print two messages, and in case 1 we only print a generic message. Remove the generic message and add a specific message when case 1 happens, so that we always have one specific message without even increasing the number of dev_dbg*() calls. Signed-off-by: Luca Ceresoli --- No changes in v3 No changes in v2 --- drivers/staging/media/tegra-video/vi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c index ae7adf640e76..0e5067a7986a 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -1272,7 +1272,7 @@ static int tegra_vi_channels_alloc(struct tegra_vi *vi) ports = of_get_child_by_name(node, "ports"); if (!ports) - return -ENODEV; + return dev_err_probe(vi->dev, -ENODEV, "%pOF: missing 'ports' node\n", node); for_each_child_of_node(ports, port) { if (!of_node_name_eq(port, "port")) @@ -1824,11 +1824,8 @@ static int tegra_vi_init(struct host1x_client *client) ret = tegra_vi_tpg_channels_alloc(vi); else ret = tegra_vi_channels_alloc(vi); - if (ret < 0) { - dev_err(vi->dev, - "failed to allocate vi channels: %d\n", ret); + if (ret < 0) goto free_chans; - } ret = tegra_vi_channels_init(vi); if (ret < 0)