Thread (26 messages) 26 messages, 5 authors, 2025-09-26

Re: [PATCH net-next v2 5/6] bnxt_fwctl: Add bnxt fwctl device

From: Pavan Chebbi <pavan.chebbi@broadcom.com>
Date: 2025-09-25 04:31:42

On Thu, Sep 25, 2025 at 4:02 AM Dave Jiang [off-list ref] wrote:
quoted
+static void *bnxtctl_fw_rpc(struct fwctl_uctx *uctx,
+                         enum fwctl_rpc_scope scope,
+                         void *in, size_t in_len, size_t *out_len)
+{
+     struct bnxtctl_dev *bnxtctl =
+             container_of(uctx->fwctl, struct bnxtctl_dev, fwctl);
+     struct bnxt_aux_priv *bnxt_aux_priv = bnxtctl->aux_priv;
+     struct fwctl_dma_info_bnxt *dma_buf = NULL;
+     struct device *dev = &uctx->fwctl->dev;
+     struct fwctl_rpc_bnxt *msg = in;
+     struct bnxt_fw_msg rpc_in;
+     int i, rc, err = 0;
+     int dma_buf_size;
+
+     rpc_in.msg = kzalloc(msg->req_len, GFP_KERNEL);
I think if you use __free(kfree) for all the allocations in the function, you can be rid of the gotos.
Thanks Dave for the review. Would you be fine if I defer using scope
based cleanup for later?
I need some time to understand the mechanism better and correctly
define the macros as some
pointers holding the memory are members within a stack variable. I
will fix the goto/free issues
you highlighted in the next revision. I hope that is going to be OK?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help