From patchwork Mon Nov 28 15:23:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 26823 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5750067wrr; Mon, 28 Nov 2022 07:27:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf5EnVHlGJvSdKfp1CbIp+j83ajU2P3m8tH/mKsGt6PvNADkTnwObJrftT1GCBKEHonSqx5j X-Received: by 2002:a50:fc0b:0:b0:46b:5812:a03a with SMTP id i11-20020a50fc0b000000b0046b5812a03amr2357314edr.91.1669649279282; Mon, 28 Nov 2022 07:27:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669649279; cv=none; d=google.com; s=arc-20160816; b=t2HnAE76aQ0Du1gD+UpEcw4A5NRFXONjk/+WTNCOi48diJh09QUCtIT09D7amRsm+u cGEF+3gIbGvDSB+BqnPNB+MQvVNfmCuxOveIH244usSvSsoCoMk2S3JGae7L0MQRvy+a aeKB+MXOpehrLuy04dSsisSOTQyyWhIYTbZWFd4O+QQ4tRFHvPQM2wVhKv9DhW8cbfDU WbUYQgHCU0JUWUr9ZCHACODmX9+bHDF/gRyn6n4P2cBN7OjTK3CgQRRoLR3MP3S5SWC4 4cyS05Ji41T7ACn2nAD8LiH+wJzK7MdrOGgD2f1cvHHw3yIlPYHgZlqtYL+OwnGhGtjB 1E0A== 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=J271X6sQL9QKZKy2Whlnvafa/eus3qhzYlvnxAfUjx4=; b=ESBAFYep/ZHPXsfUybjJ4gPLbXsChsbOL1olaaIDtUDyxSNh6C9XNqos1DGZW/MuE2 B9jHdOptCkUefXAk90xVMSykF9kXZxJLgQ0jOMIuYA2xQqnGbem6YJLozApZSL7GlSlg okdYg8dxTRdXuoR9DrU6cdQGtglnZTT/3zDovP+K+ElmkcPtNDjcTtVrzpi+wQPUeoYP dZ71nQMZs0HSTEm2tj0OOgUNS9aqWjJj8Q21pi63pfmsvfyrxKNKXmJdODlN2qjDBhhY lsGZEoxhZnkB9GUYh91zFfr5Vz03RltvVgEnnZkm/xcB6nRWFWx1IV6elXr1gV7NdIcY OcOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KlaNEP9t; 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 b15-20020a056402084f00b0046453c36c4csi12595037edz.513.2022.11.28.07.27.31; Mon, 28 Nov 2022 07:27:59 -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=KlaNEP9t; 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 S231701AbiK1P02 (ORCPT + 99 others); Mon, 28 Nov 2022 10:26:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbiK1P0G (ORCPT ); Mon, 28 Nov 2022 10:26:06 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F541252A2; Mon, 28 Nov 2022 07:24:45 -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 8628B100004; Mon, 28 Nov 2022 15:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669649083; 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=J271X6sQL9QKZKy2Whlnvafa/eus3qhzYlvnxAfUjx4=; b=KlaNEP9tZOiHw7nNF+L1AK3syIXiKdGT3edGbAZ+kCUMKS/rqgSLt/hIogg5K/uU0Iv5NT KPe8LTa4lWCiiQsyoa3CejGA6Uis0mwlWlPgt8SMwY4DSWYhP99wI4NntEwVzGTTsNQwjU FEx4S+LxBDuPHqPCHiJHYnVxsTS7ff8AM+2X4njaLzTeHWtfetV8Gazgwyh+/FY0ToIAc2 y6cQCKMAZh5v6Wz1Ta63j9LC3E94MMjTGm7uUHdtnZ1lLWHuFJg6KORGYZBJzsmBqaeoVd /sK9Kf7el1iRv+bDEqXJVJ01mhbB5XjdsaEizz7XeTBzfWUzXVfjgZEO+plgpA== From: Luca Ceresoli To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Mauro Carvalho Chehab , Greg Kroah-Hartman , Dmitry Osipenko , Hans Verkuil Cc: Luca Ceresoli , 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 v2 07/21] staging: media: tegra-video: improve error messages Date: Mon, 28 Nov 2022 16:23:22 +0100 Message-Id: <20221128152336.133953-8-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128152336.133953-1-luca.ceresoli@bootlin.com> References: <20221128152336.133953-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?1750754162826675801?= X-GMAIL-MSGID: =?utf-8?q?1750754162826675801?= 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 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 b24b9353077f..24de4ed1eaf0 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)