From patchwork Wed Jan 6 09:09:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 12001193 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9554C433DB for ; Wed, 6 Jan 2021 09:10:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 943BB2310A for ; Wed, 6 Jan 2021 09:10:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726725AbhAFJKQ (ORCPT ); Wed, 6 Jan 2021 04:10:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726346AbhAFJKP (ORCPT ); Wed, 6 Jan 2021 04:10:15 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AF0AC06134D for ; Wed, 6 Jan 2021 01:09:35 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id x20so4909984lfe.12 for ; Wed, 06 Jan 2021 01:09:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WXb8ZbXP3cgf2Fgkbx8Pw1yOIWIB+RyqLEJVZ8Z4lLk=; b=YH26p+llWbMpPx65LLEgAZSsNMgyxAadr7BxxTCZsHJysAAM7cPe81cw1JeKnD4gLg rqr/H0OBfNKP/23BsgLeaHM2DLdxx43dB9L6GcfhdZKY2qYtpc1nLmzfv8Iia8ZyfY3a NxacykOBa7moG7nUI6Hn7x0RVZ2Vxz/HbeoA6o8uJgKll9B525L6EvweBzpHD2/onxmD 7BMYttC7UON8pu3rzyNbgsqN+L4OUprS8vGMZMN/nqZdrFfroNyNhB0J0moUSbfNnmip sDVW0OuErGIuyV36m7tL9nGO58XgnOWObyj0JghJ8H/GhJSb5F1GCb4y4lsSpGz4cY6X YdOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WXb8ZbXP3cgf2Fgkbx8Pw1yOIWIB+RyqLEJVZ8Z4lLk=; b=dgc7Q3ia+gUGQiGo53Ma752K5c3ixj6AbeCwEyfrpI73VKznIzQ2pK6N7KsbiHXm+B YLlj1199Kb015yDJAIPwkAj6WlmBDFhbXSrs8ve8/KaimfmtHvtyZXaeVq73bLbXOF0X 1wCjsf2uPuDWhj7YTbjlbjm3U4z1TgQoLXPxOfG/uPA7Bmu89yogoLEBK1bgrY1SMHxB QBYk9B2JFtpaLacSm1KGi5oWz7voa9Be/T4OUpzW+fCcoFNwRLzDmsfVo6ZPeuFApDq8 p/ln2jWBI2ZmArCDKP3bNtT9fMXHiqZz+iGYvYwf0sqFPClFJJ6TFE5ucV3ZglIRwTpa oxlw== X-Gm-Message-State: AOAM530kD7D53jgOCqPwVH937Y6eDbBfgBeFeKpfr53efZPdvd7jLQBC sUlKUd0ASUyCmaRazLVlHCtk/IjoSYs1VQ== X-Google-Smtp-Source: ABdhPJw0F0w5yIsIF02ScYBJMua0rt9nhNGD2v7UavFZcbJGH596yZORLolVkmv6X9FzAmNXKxliKA== X-Received: by 2002:a2e:a407:: with SMTP id p7mr1651300ljn.78.1609924173796; Wed, 06 Jan 2021 01:09:33 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id r201sm222335lff.268.2021.01.06.01.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 01:09:33 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean Cc: "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, =?utf-8?b?UmFm?= =?utf-8?b?YcWCIE1pxYJlY2tp?= Subject: [PATCH next] net: dsa: print error on invalid port index Date: Wed, 6 Jan 2021 10:09:15 +0100 Message-Id: <20210106090915.21439-1-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Rafał Miłecki Looking for an -EINVAL all over the dsa code could take hours for inexperienced DSA users. Signed-off-by: Rafał Miłecki Reviewed-by: Andrew Lunn --- net/dsa/dsa2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 183003e45762..01f21b0b379a 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -783,6 +783,8 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds, goto out_put_node; if (reg >= ds->num_ports) { + dev_err(ds->dev, "port %pOF index %u exceeds num_ports (%zu)\n", + port, reg, ds->num_ports); err = -EINVAL; goto out_put_node; }