From patchwork Wed Nov 9 14:18:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 17585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp360825wru; Wed, 9 Nov 2022 06:21:58 -0800 (PST) X-Google-Smtp-Source: AMsMyM77c9npRQhi2WkFYlWzSkPuKNJxQXbe+XoFxzZdfNfCiu/jQTtMXJrTh83IysB9+ZxTZdqf X-Received: by 2002:a17:906:dac9:b0:780:ab6f:591f with SMTP id xi9-20020a170906dac900b00780ab6f591fmr57147636ejb.77.1668003718502; Wed, 09 Nov 2022 06:21:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668003718; cv=none; d=google.com; s=arc-20160816; b=c/CGXlVkyd82QMtX+WZCSSFBPj4UjytARMMMeYbMY0CoQSs94N083niL6OS3l454fF f/AEv0HmY2IOKBO2G1ZcdTr2/F3cy8PHAbf95J6cjXhmLEO0nozuldipNZS8r3VJ+gcV 5YOJHhBOjY6RQjZhrWqyYK1nOENGQMNlz5CVf/9nzmaRJyv2U5f5+VkZpf20IKNvbt6b IZOBcBWp3fmyrNx44ciM+Z+sVgw/hXD9v8/D1ujsmtv8pbjchWlAnCQye87fbZqKd44Q rJEIv2LVLsLqyqdIAlaTFRosA5+rCzHlJ819A9ZfP5TIrpOY9cJ4y5RHwzAwGxMBoLhx bDFw== 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=6RsU9udyOxbtNMCtf0EHobHgYEBuyM2u9K+TcM2I99E=; b=zjeYoZNpApP3jaN5z2lDEo5e2yRMm/wsph/MaDvHgiUwrQNADT4P+NfGY36t3RHYDz uOQJBLpDvOQQLzGJDmhFYzEgTsc0+JmM4529ON7Mo7nFp18b+XPhGTpq+S3gIkZ4mo0R rBRC2ixlbShjoiUT91E5lpGfVbpedomgYdQetbd//GXE7VGLAz9vadTMvZXsHdqthAMh OJcs82oPm1O/wcopNLTTBSrn0vgv3qgt6XqOM5mpH7joieTlYyha/bt1i6C6H/JDVlft 33ez7L7pMmMYIhve/EUezR56+nPIRLpqKuoKay3Qvmp0NA3BP7/322yl1WgOU4FA/fRz CGiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=biRjzYCK; 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 hw19-20020a170907a0d300b007aa493b067asi11749282ejc.396.2022.11.09.06.21.33; Wed, 09 Nov 2022 06:21:58 -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=biRjzYCK; 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 S231393AbiKIOUa (ORCPT + 99 others); Wed, 9 Nov 2022 09:20:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231270AbiKIOT7 (ORCPT ); Wed, 9 Nov 2022 09:19:59 -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 D123A21E3E; Wed, 9 Nov 2022 06:19:44 -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 06392FF803; Wed, 9 Nov 2022 14:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1668003581; 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=6RsU9udyOxbtNMCtf0EHobHgYEBuyM2u9K+TcM2I99E=; b=biRjzYCKiMiK3svK2VKWNf11WrjwfSmb93QTki/yAX5a4oGK9goYuwsp74LGimY6D8+sKX nys7/la8xEr3zJzK5ZZqcUPCi0b36LSY+ZV279xJAgoDTTCvaHzeJacDH00xOcHHs5RZ2i l2V1Z0CxzaSfrz2xQd0nBs1C15rdfqt/oWwEYcndru3Kgovd51zcTkThHNjbbBWQuVWHU1 o54R5jFItRiHIqe21ThCJ0l0LZcK68kGMLiUfhiR8u4VkfwN4gKBhtv3rI9ljRcHBe2IrP 5RyAcHEkpHwSpDlE2qBF9AeSiMW4hJg8Zd+ebdUepgjORZC9TFcfDnx4KVuscA== From: luca.ceresoli@bootlin.com To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Mauro Carvalho Chehab , Greg Kroah-Hartman , Hans Verkuil , Dmitry Osipenko 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 , Richard Leitner Subject: [PATCH 09/23] staging: media: tegra-video: improve error messages Date: Wed, 9 Nov 2022 15:18:38 +0100 Message-Id: <20221109141852.729246-10-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221109141852.729246-1-luca.ceresoli@bootlin.com> References: <20221109141852.729246-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?1749028666856615572?= X-GMAIL-MSGID: =?utf-8?q?1749028666856615572?= From: Luca Ceresoli 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 --- 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)