From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9379C54EBE for ; Fri, 13 Jan 2023 07:06:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zYudHO7slOKvqixiWzK3czX/+QtM+YdzqpG19tvZ648=; b=v+3cKaSVYqiuOE 9MBIlkBfiMaUMJY7PYhPWge3NDdi1x4flUYVTU7sAYskrmd/Ty5QQMmEqovwQUw/YYucrCfpQDp2U ft6n3IfL83edf+47ruJ87KNGdxAZTKaVp5psRG377ieGwCY1XoBAdeTZhLzx74KWV78B4lexgj6C3 qarV6RcDqNmaKsZWzGXSRlvz5eyGxlfxv3fBezFm1SsFhDly6+24Jpct+I6s+CsnljLPLBQem5x0O AaiOURtqhIk/5pPb7WYcPbe1WXMEQjge+Gwz+3fsy3HGZmHpDFYAJEmS4JxWQ5IWs/bzF4irUxcbV ueGuFj/VPwdhoHMThJeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGE7X-000vHY-OJ; Fri, 13 Jan 2023 07:04:59 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGE7T-000vGS-9z for linux-arm-kernel@lists.infradead.org; Fri, 13 Jan 2023 07:04:56 +0000 Received: by mail-wr1-x431.google.com with SMTP id bk16so20144197wrb.11 for ; Thu, 12 Jan 2023 23:04:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=j2qn42yyMZbo6TrbPBAsI283zrpFQp4cNY9d6GcZLKw=; b=QXyktMd/lr18PfK1hb1/U4RSGMQooojDNQc+LM4xgDXElkKq7ViRbTcvFJf2WzZ78x Pf08q2pxyvRVuyZef0hpk3oluzFsICr1X1tmd/ZqScQoHoZ+sJt0MvzdrghHN7ee2oy9 o/CF9iGcu2V5WbsLtTsP6s6DNpkstAHBdL+d4H+8vv3WHTyTyoqSLn4LiEMXWTD9TIoC Dgw1AVkErFSe1uNvB7SIx9a1l0XUViDuiRJlwvLPw3eyaeBfLqBo1MEydYCQNOf/5qwn gR69xjrpdoKmWSlGb+ONNmU+oJJEKvHU1fnwgpevtlXvQ+LNgJsvsxP9idXKKAax/lkn f8JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=j2qn42yyMZbo6TrbPBAsI283zrpFQp4cNY9d6GcZLKw=; b=jfHrv12lAK3Gfu9kbj4vJhuXDca/mblURWb8F/SdNS1Oj8uz4Pr1A74igH8LrCvx5d /iYbCEny1gADsdbWDoqHN3WynBsvic5BwvGtuW3VjPFc4Lnug2I8zwGMd+ylTQNx2UcU DpoYIIGAFXgKgFv9Tp5i8UphJWGaSny9G68R/dlqtRfxI225I9Ebfvn3Hru3FfHpPSXb vpky5/o6SI1GFrFQHHNWv3DvD4QRW1XJbpmugp4B1GgcJdztlGrXgu4ut7SR7QCB2+ze iyX9H6SSohMPzmTd6KzkMNRQDMvMkiQFHCK7cNCOSoiDR31IuPIlvcyTZn5jQuHXe6UE Bk0Q== X-Gm-Message-State: AFqh2krOVoAugQbhjZIW/anhfd11NuqPohx7KtwQVSS5oseR0PY8W6fv Xl4vW/tkvT/GuWQ/VMeWvqk= X-Google-Smtp-Source: AMrXdXtWAQCQRjcANCUXbI+FBSURPUxW7KfOAQf0/PpNSd8emifmBvT7oAxVJfTDYi7Wvnp3liT9BQ== X-Received: by 2002:a05:6000:408b:b0:242:8404:6b66 with SMTP id da11-20020a056000408b00b0024284046b66mr57175857wrb.1.1673593490619; Thu, 12 Jan 2023 23:04:50 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id w5-20020adfcd05000000b002bdc914a139sm5623348wrm.108.2023.01.12.23.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 23:04:50 -0800 (PST) Date: Fri, 13 Jan 2023 10:04:38 +0300 From: Dan Carpenter To: Daniel Machon Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, lars.povlsen@microchip.com, Steen.Hegelund@microchip.com, UNGLinuxDriver@microchip.com, joe@perches.com, horatiu.vultur@microchip.com, Julia.Lawall@inria.fr, petrm@nvidia.com, vladimir.oltean@nxp.com, maxime.chevallier@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 3/6] net: dcb: add new rewrite table Message-ID: References: <20230112201554.752144-1-daniel.machon@microchip.com> <20230112201554.752144-4-daniel.machon@microchip.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230112201554.752144-4-daniel.machon@microchip.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230112_230455_370485_ADC86FB0 X-CRM114-Status: GOOD ( 15.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jan 12, 2023 at 09:15:51PM +0100, Daniel Machon wrote: > +/* Get protocol value from rewrite entry. */ > +u16 dcb_getrewr(struct net_device *dev, struct dcb_app *app) ^^^ > +{ > + struct dcb_app_type *itr; > + u8 proto = 0; Should "proto" be a u16 to match itr->app.protocol and the return type? > + > + spin_lock_bh(&dcb_lock); > + itr = dcb_rewr_lookup(app, dev->ifindex, -1); > + if (itr) > + proto = itr->app.protocol; > + spin_unlock_bh(&dcb_lock); > + > + return proto; > +} > +EXPORT_SYMBOL(dcb_getrewr); > + > + /* Add rewrite entry to the rewrite list. */ > +int dcb_setrewr(struct net_device *dev, struct dcb_app *new) > +{ > + int err = 0; No need to initialize this. It only disables static checkers and triggers a false positive about dead stores. > + > + spin_lock_bh(&dcb_lock); > + /* Search for existing match and abort if found. */ > + if (dcb_rewr_lookup(new, dev->ifindex, new->protocol)) { > + err = -EEXIST; > + goto out; > + } > + > + err = dcb_app_add(&dcb_rewr_list, new, dev->ifindex); > +out: > + spin_unlock_bh(&dcb_lock); > + > + return err; > +} regards, dan carpenter _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel