Commit 28e63d01 authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'bnxt_en-bug-fixes'

Michael Chan says:

====================
bnxt_en: Bug fixes

This small series contains 2 fixes.  The first one fixes the PTP
initialization logic on older chips to avoid logging a warning.  The
second one fixes a potenial NULL pointer dereference in the driver's
aux bus unload path.
====================

Link: https://lore.kernel.org/r/20230417065819.122055-1-michael.chan@broadcom.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents e50b9b9e 4f4e54b1
...@@ -7627,7 +7627,7 @@ static int __bnxt_hwrm_ptp_qcfg(struct bnxt *bp) ...@@ -7627,7 +7627,7 @@ static int __bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
u8 flags; u8 flags;
int rc; int rc;
if (bp->hwrm_spec_code < 0x10801) { if (bp->hwrm_spec_code < 0x10801 || !BNXT_CHIP_P5_THOR(bp)) {
rc = -ENODEV; rc = -ENODEV;
goto no_ptp; goto no_ptp;
} }
......
...@@ -304,7 +304,7 @@ void bnxt_rdma_aux_device_uninit(struct bnxt *bp) ...@@ -304,7 +304,7 @@ void bnxt_rdma_aux_device_uninit(struct bnxt *bp)
struct auxiliary_device *adev; struct auxiliary_device *adev;
/* Skip if no auxiliary device init was done. */ /* Skip if no auxiliary device init was done. */
if (!(bp->flags & BNXT_FLAG_ROCE_CAP)) if (!bp->aux_priv)
return; return;
aux_priv = bp->aux_priv; aux_priv = bp->aux_priv;
...@@ -324,6 +324,7 @@ static void bnxt_aux_dev_release(struct device *dev) ...@@ -324,6 +324,7 @@ static void bnxt_aux_dev_release(struct device *dev)
bp->edev = NULL; bp->edev = NULL;
kfree(aux_priv->edev); kfree(aux_priv->edev);
kfree(aux_priv); kfree(aux_priv);
bp->aux_priv = NULL;
} }
static void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt *bp) static void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt *bp)
...@@ -359,19 +360,18 @@ void bnxt_rdma_aux_device_init(struct bnxt *bp) ...@@ -359,19 +360,18 @@ void bnxt_rdma_aux_device_init(struct bnxt *bp)
if (!(bp->flags & BNXT_FLAG_ROCE_CAP)) if (!(bp->flags & BNXT_FLAG_ROCE_CAP))
return; return;
bp->aux_priv = kzalloc(sizeof(*bp->aux_priv), GFP_KERNEL); aux_priv = kzalloc(sizeof(*bp->aux_priv), GFP_KERNEL);
if (!bp->aux_priv) if (!aux_priv)
goto exit; goto exit;
bp->aux_priv->id = ida_alloc(&bnxt_aux_dev_ids, GFP_KERNEL); aux_priv->id = ida_alloc(&bnxt_aux_dev_ids, GFP_KERNEL);
if (bp->aux_priv->id < 0) { if (aux_priv->id < 0) {
netdev_warn(bp->dev, netdev_warn(bp->dev,
"ida alloc failed for ROCE auxiliary device\n"); "ida alloc failed for ROCE auxiliary device\n");
kfree(bp->aux_priv); kfree(aux_priv);
goto exit; goto exit;
} }
aux_priv = bp->aux_priv;
aux_dev = &aux_priv->aux_dev; aux_dev = &aux_priv->aux_dev;
aux_dev->id = aux_priv->id; aux_dev->id = aux_priv->id;
aux_dev->name = "rdma"; aux_dev->name = "rdma";
...@@ -380,10 +380,11 @@ void bnxt_rdma_aux_device_init(struct bnxt *bp) ...@@ -380,10 +380,11 @@ void bnxt_rdma_aux_device_init(struct bnxt *bp)
rc = auxiliary_device_init(aux_dev); rc = auxiliary_device_init(aux_dev);
if (rc) { if (rc) {
ida_free(&bnxt_aux_dev_ids, bp->aux_priv->id); ida_free(&bnxt_aux_dev_ids, aux_priv->id);
kfree(bp->aux_priv); kfree(aux_priv);
goto exit; goto exit;
} }
bp->aux_priv = aux_priv;
/* From this point, all cleanup will happen via the .release callback & /* From this point, all cleanup will happen via the .release callback &
* any error unwinding will need to include a call to * any error unwinding will need to include a call to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment