Re: [PATCH V1] net: mhi : Add support to enable ethernet interface

From: Simon Horman
Date: Fri Jun 30 2023 - 09:13:37 EST


On Fri, Jun 30, 2023 at 03:14:41PM +0530, Vivek Pernamitta wrote:
> Add support to enable ethernet interface for MHI SWIP channels.
>
> Signed-off-by: Vivek Pernamitta <quic_vpernami@xxxxxxxxxxx>

...

> @@ -301,11 +318,17 @@ static void mhi_net_rx_refill_work(struct work_struct *work)
> schedule_delayed_work(&mhi_netdev->rx_refill, HZ / 2);
> }
>
> -static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
> +static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev, bool eth_dev)
> {
> struct mhi_net_dev *mhi_netdev;
> int err;
>
> + if (eth_dev) {
> + eth_random_addr(ndev->dev_addr);
> + if (!is_valid_ether_addr(ndev->dev_addr))
> + return -EADDRNOTAVAIL;
> + }

Hi Vivek,

This doesn't seem right.
As GCC points out, dev_addr is const.
And I don't think eth_random_addr() produces invalid addresses.

Perhaps you want eth_hw_addr_random() here.

As was mentioned elsewhere in this thread, net-next, is closed.
So please post a v2 once it re-opens, after 10th July.

--
pw-bot: changes-requested