[PATCH 2/3] net/hns3: fix unrelease VLAN resource when init fail
Stephen Hemminger
stephen at networkplumber.org
Wed Sep 10 18:03:22 CEST 2025
On Thu, 21 Aug 2025 20:16:25 +0800
huangdengdui <huangdengdui at huawei.com> wrote:
> On 2025/8/13 22:51, Stephen Hemminger wrote:
> > On Wed, 13 Aug 2025 15:33:16 +0800
> > Dengdui Huang <huangdengdui at huawei.com> wrote:
> >
> >> +static void
> >> +hns3_uninit_hardware(struct hns3_hw *hw)
> >> +{
> >> + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
> >> +
> >> + (void)hns3_uninit_umv_space(hw);
> >
> > Overall, the patch looks good. But why the (void) cast here.
> > The compiler allows ignoring return value unless the must check attribute is set.
>
> Our internal coding standards require that when we do not check the return value of a function,
> we use `(void)` to indicate that we have thoroughly considered that it is unnecessary to handle the return value here.
Having a close or uninit function return an error code is rarely useful.
The application is left with "what now scenario".
This style goes back to 90's BSD style. Probably when your coding standards were written..
PS: if you want to force checking of return value, there are attributes for that.
More information about the dev
mailing list