[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8EChkENXkUjfUQf@kadam>
Date: Fri, 13 Jan 2023 10:04:38 +0300
From: Dan Carpenter <error27@...il.com>
To: Daniel Machon <daniel.machon@...rochip.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, lars.povlsen@...rochip.com,
Steen.Hegelund@...rochip.com, UNGLinuxDriver@...rochip.com,
joe@...ches.com, horatiu.vultur@...rochip.com,
Julia.Lawall@...ia.fr, petrm@...dia.com, vladimir.oltean@....com,
maxime.chevallier@...tlin.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 3/6] net: dcb: add new rewrite table
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
Powered by blists - more mailing lists