pds_core: Fix up some minor issues
authorBrett Creeley <brett.creeley@amd.com>
Fri, 2 Feb 2024 19:59:10 +0000 (11:59 -0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 6 Feb 2024 12:26:54 +0000 (13:26 +0100)
Running xmastree.py against the driver found some
RCT issues, so fix them.

Also, if allocating pdsc->intr_info in pdsc_dev_init()
fails the driver still tries to free pdsc->intr_info.
Fix this by just returning -ENOMEM since there's
nothing to free at this point of failure.

Signed-off-by: Brett Creeley <brett.creeley@amd.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/amd/pds_core/debugfs.c
drivers/net/ethernet/amd/pds_core/dev.c

index ba592dbeef141c79d8e34c6f3b3c4a25a8d38480..6bdd02b7aa6de287851432aefdf78bfe36d3da1b 100644 (file)
@@ -32,8 +32,8 @@ void pdsc_debugfs_del_dev(struct pdsc *pdsc)
 
 static int identity_show(struct seq_file *seq, void *v)
 {
-       struct pdsc *pdsc = seq->private;
        struct pds_core_dev_identity *ident;
+       struct pdsc *pdsc = seq->private;
        int vt;
 
        ident = &pdsc->dev_ident;
@@ -106,8 +106,7 @@ static const struct debugfs_reg32 intr_ctrl_regs[] = {
 
 void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq)
 {
-       struct dentry *qcq_dentry, *q_dentry, *cq_dentry;
-       struct dentry *intr_dentry;
+       struct dentry *qcq_dentry, *q_dentry, *cq_dentry, *intr_dentry;
        struct debugfs_regset32 *intr_ctrl_regset;
        struct pdsc_queue *q = &qcq->q;
        struct pdsc_cq *cq = &qcq->cq;
index e65a1632df505d55de687ba781166299d865eaae..7dc102a311853cfebd07396760b835dd9942abdc 100644 (file)
@@ -341,10 +341,8 @@ int pdsc_dev_init(struct pdsc *pdsc)
 
        /* Get intr_info struct array for tracking */
        pdsc->intr_info = kcalloc(nintrs, sizeof(*pdsc->intr_info), GFP_KERNEL);
-       if (!pdsc->intr_info) {
-               err = -ENOMEM;
-               goto err_out;
-       }
+       if (!pdsc->intr_info)
+               return -ENOMEM;
 
        err = pci_alloc_irq_vectors(pdsc->pdev, nintrs, nintrs, PCI_IRQ_MSIX);
        if (err != nintrs) {