From: Vladimir Oltean <olteanv@gmail.com>
To: Arun Ramadoss <arun.ramadoss@microchip.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Russell King <linux@armlinux.org.uk>,
Woojung Huh <woojung.huh@microchip.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Oleksij Rempel <linux@rempel-privat.de>,
Marek Vasut <marex@denx.de>,
Michael Grzeschik <m.grzeschik@pengutronix.de>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [RFC Patch net-next v2 5/9] net: dsa: microchip: move struct mib_names to ksz_chip_data
Date: Mon, 16 May 2022 14:23:42 +0300 [thread overview]
Message-ID: <20220516112342.5euhhzohvpziwwxe@skbuf> (raw)
In-Reply-To: <20220513102219.30399-6-arun.ramadoss@microchip.com>
On Fri, May 13, 2022 at 03:52:15PM +0530, Arun Ramadoss wrote:
> The ksz88xx family has one set of mib_names. The ksz87xx, ksz9477,
> LAN937x based switches has one set of mib_names. In order to remove
> redundant declaration, moved the struct mib_names to ksz_chip_data
> structure. And allocated the mib memory in switch_register instead of
> individual switch_init function.
>
> Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
> ---
> static int ksz9477_switch_init(struct ksz_device *dev)
> {
> - int i;
> -
> dev->ds->ops = &ksz9477_switch_ops;
>
> dev->port_mask = (1 << dev->info->port_cnt) - 1;
>
> - dev->reg_mib_cnt = SWITCH_COUNTER_NUM;
> - dev->mib_cnt = TOTAL_SWITCH_COUNTER_NUM;
> -
> - for (i = 0; i < dev->info->port_cnt; i++) {
> - spin_lock_init(&dev->ports[i].mib.stats64_lock);
> - mutex_init(&dev->ports[i].mib.cnt_mutex);
> - dev->ports[i].mib.counters =
> - devm_kzalloc(dev->dev,
> - sizeof(u64) *
> - (TOTAL_SWITCH_COUNTER_NUM + 1),
> - GFP_KERNEL);
> - if (!dev->ports[i].mib.counters)
> - return -ENOMEM;
> - }
> -
This fixes the NULL pointer dereference on probe that was introduced in
the previous patch, but please make sure that this does not happen in
the first place, for bisectability purposes.
> return 0;
> }
next prev parent reply other threads:[~2022-05-16 11:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 10:22 [RFC Patch net-next v2 0/9] net: dsa: microchip: refactor the ksz switch init function Arun Ramadoss
2022-05-13 10:22 ` [RFC Patch net-next v2 1/9] net: dsa: microchip: ksz8795: update the port_cnt value in ksz_chip_data Arun Ramadoss
2022-05-16 10:40 ` Vladimir Oltean
2022-05-17 2:53 ` Florian Fainelli
2022-05-13 10:22 ` [RFC Patch net-next v2 2/9] net: dsa: microchip: move ksz_chip_data to ksz_common Arun Ramadoss
2022-05-16 10:51 ` Vladimir Oltean
2022-05-17 2:55 ` Florian Fainelli
2022-05-13 10:22 ` [RFC Patch net-next v2 3/9] net: dsa: microchip: perform the compatibility check for dev probed Arun Ramadoss
2022-05-16 11:03 ` Vladimir Oltean
2022-05-16 11:08 ` Vladimir Oltean
2022-05-13 10:22 ` [RFC Patch net-next v2 4/9] net: dsa: microchip: move port memory allocation to ksz_common Arun Ramadoss
2022-05-16 11:12 ` Vladimir Oltean
2022-05-13 10:22 ` [RFC Patch net-next v2 5/9] net: dsa: microchip: move struct mib_names to ksz_chip_data Arun Ramadoss
2022-05-16 11:23 ` Vladimir Oltean [this message]
2022-05-13 10:22 ` [RFC Patch net-next v2 6/9] net: dsa: microchip: move get_strings to ksz_common Arun Ramadoss
2022-05-16 11:24 ` Vladimir Oltean
2022-05-17 2:56 ` Florian Fainelli
2022-05-13 10:22 ` [RFC Patch net-next v2 7/9] net: dsa: move mib->cnt_ptr reset code to ksz_common.c Arun Ramadoss
2022-05-16 11:25 ` Vladimir Oltean
2022-05-17 2:56 ` Florian Fainelli
2022-05-13 10:22 ` [RFC Patch net-next v2 8/9] net: dsa: microchip: add the phylink get_caps Arun Ramadoss
2022-05-16 11:29 ` Vladimir Oltean
2022-05-17 2:58 ` Florian Fainelli
2022-05-13 10:22 ` [RFC Patch net-next v2 9/9] net: dsa: microchip: remove unused members in ksz_device Arun Ramadoss
2022-05-16 11:30 ` Vladimir Oltean
2022-05-17 2:58 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220516112342.5euhhzohvpziwwxe@skbuf \
--to=olteanv@gmail.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=arun.ramadoss@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@rempel-privat.de \
--cc=m.grzeschik@pengutronix.de \
--cc=marex@denx.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.com \
--cc=woojung.huh@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox