[Intel-wired-lan] [PATCH iwl-next v9 01/15] ice: add parser create and destroy skeleton
Michal Schmidt
mschmidt at redhat.com
Wed Sep 6 10:49:59 UTC 2023
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
More information about the Intel-wired-lan
mailing list