[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <72beaab3-1f88-4f46-a451-2af9da8caff4@redhat.com>
Date: Wed, 6 Sep 2023 12:49:59 +0200
From: Michal Schmidt <mschmidt@...hat.com>
To: Junfeng Guo <junfeng.guo@...el.com>, intel-wired-lan@...ts.osuosl.org
Cc: ivecera@...hat.com, netdev@...r.kernel.org, qi.z.zhang@...el.com,
jesse.brandeburg@...el.com, edumazet@...gle.com, anthony.l.nguyen@...el.com,
horms@...nel.org, kuba@...nel.org, pabeni@...hat.com, davem@...emloft.net
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v9 01/15] ice: add parser
create and destroy skeleton
Dne 04. 09. 23 v 4:14 Junfeng Guo napsal(a):
> diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c
> new file mode 100644
> index 000000000000..747dfad66db2
> --- /dev/null
> +++ b/drivers/net/ethernet/intel/ice/ice_parser.c
> @@ -0,0 +1,33 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (C) 2023 Intel Corporation */
> +
> +#include "ice_common.h"
> +
> +/**
> + * ice_parser_create - create a parser instance
> + * @hw: pointer to the hardware structure
> + * @psr: output parameter for a new parser instance be created
> + */
> +int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr)
> +{
> + struct ice_parser *p;
> +
> + p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(struct ice_parser),
> + GFP_KERNEL);
> + if (!p)
> + return -ENOMEM;
> +
> + p->hw = hw;
> +
> + *psr = p;
> + return 0;
> +}
The function could just return the pointer directly. You can use ERR_PTR
to encode all kinds of failures.
Michal
Powered by blists - more mailing lists