Message ID | 20221004101200.758009-1-usama.anjum@collabora.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: mana: store return status in signed variable | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Guessing tree name failed - patch did not apply |
> Subject: [PATCH] net: mana: store return status in signed variable > > [Some people who received this message don't often get email from > usama.anjum@collabora.com. Learn why this is important at > https://aka.ms/LearnAboutSenderIdentification ] > > The mana_adev_idx_alloc() can return negative value. Save its return value > in ret which is signed variable and check if it is correct value. > > Fixes: ee928282bfa7 ("net: mana: Add support for auxiliary device") > Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> > --- > drivers/net/ethernet/microsoft/mana/mana_en.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c > b/drivers/net/ethernet/microsoft/mana/mana_en.c > index 7ca313c7b7b3..1c59502d34b5 100644 > --- a/drivers/net/ethernet/microsoft/mana/mana_en.c > +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c > @@ -2203,11 +2203,10 @@ static int add_adev(struct gdma_dev *gd) > return -ENOMEM; > > adev = &madev->adev; > - adev->id = mana_adev_idx_alloc(); > - if (adev->id < 0) { > - ret = adev->id; > + ret = mana_adev_idx_alloc(); > + if (ret < 0) > goto idx_fail; > - } > + adev->id = ret; > > adev->name = "rdma"; > adev->dev.parent = gd->gdma_context->dev; > -- > 2.30.2 Thank you, I'm folding this patch into the next v7 patch series. Long
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 7ca313c7b7b3..1c59502d34b5 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -2203,11 +2203,10 @@ static int add_adev(struct gdma_dev *gd) return -ENOMEM; adev = &madev->adev; - adev->id = mana_adev_idx_alloc(); - if (adev->id < 0) { - ret = adev->id; + ret = mana_adev_idx_alloc(); + if (ret < 0) goto idx_fail; - } + adev->id = ret; adev->name = "rdma"; adev->dev.parent = gd->gdma_context->dev;
The mana_adev_idx_alloc() can return negative value. Save its return value in ret which is signed variable and check if it is correct value. Fixes: ee928282bfa7 ("net: mana: Add support for auxiliary device") Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> --- drivers/net/ethernet/microsoft/mana/mana_en.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)