Re: [PATCH] net/mlx4_core: Avoid impossible mlx4_db_alloc() order value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/13/25 1:10 AM, Justin Stitt wrote:
> On Tue, Feb 11, 2025 at 6:22 AM Tariq Toukan <ttoukan.linux@xxxxxxxxx> wrote:
>> On 11/02/2025 2:01, Justin Stitt wrote:
>>>> diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c
>>>> index b330020dc0d6..f2bded847e61 100644
>>>> --- a/drivers/net/ethernet/mellanox/mlx4/alloc.c
>>>> +++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c
>>>> @@ -682,9 +682,9 @@ static struct mlx4_db_pgdir *mlx4_alloc_db_pgdir(struct device *dma_device)
>>>>   }
>>>>
>>>>   static int mlx4_alloc_db_from_pgdir(struct mlx4_db_pgdir *pgdir,
>>>> -                                struct mlx4_db *db, int order)
>>>> +                                struct mlx4_db *db, unsigned int order)
>>>>   {
>>>> -    int o;
>>>> +    unsigned int o;
>>>>      int i;
>>>>
>>>>      for (o = order; o <= 1; ++o) {
>>>
>>>    ^ Knowing now that @order can only be 0 or 1 can this for loop (and
>>>    goto) be dropped entirely?
>>>
>>
>> Maybe I'm missing something...
>> Can you please explain why you think this can be dropped?
> 
> I meant "rewritten to use two if statements" instead of "dropped". I
> think "replaced" or "refactored" was the word I wanted.

IMHO that would be a significant uglification, not worthy to address an
issue that could be solved with the patch proposed here.

@Tariq: are you ok with this patch?

Thanks,

Paolo





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux