Re: Re: [PATCH net] net: wwan: Add net device name for error message print

From: Andrew Lunn
Date: Sat Apr 27 2024 - 09:22:51 EST


> At 2024-04-27 06:21:03, "Andrew Lunn" <andrew@xxxxxxx> wrote:
> >> if (skb->len < sizeof(struct usb_cdc_ncm_nth16) +
> >> sizeof(struct usb_cdc_ncm_ndp16)) {
> >> - net_err_ratelimited("frame too short\n");
> >> + net_err_ratelimited("mbim: frame too short\n");
> >
> >I don't know this code at all, but i think you can do
> >
> >dev_err_ratelimited(&mbim->mdev->dev, "frame too short\n");
> >
> >That way, it tells you which of the 42 mhi devices has received too
> >short a frame.
> >
> > Andrew
> I tried in my case, and it will print:
> mhi_wwan_mbim mhio_IP_HW0_MBIM: frame too short
>
> I think it's much more complicated, isn't it?

As i said, this is about making it clear which device has problems.
mhio_IP_HW0_MBI is not a particularly good name, but it should be
unique. The question is, is this built into the silicon, and can there
only be one? The name is them pointless.

It is also not too unusual to see drivers define macros

mbim_err_ratelimited(mbin, "frame too short")

Andrew