Re: [PATCH 1/1] Fixed to BUG_ON to WARN_ON def

From: Ozgur Karatas
Date: Mon Dec 12 2016 - 08:04:36 EST


Dear Romanovsky;

I'm trying to learn english and I apologize for my mistake words and phrases. So, I think the code when call to "sg_set_buf" and next time set memory and buffer. For example, isn't to call "WARN_ON" function, get a error to implicit declaration, right?

Because, you will use to "BUG_ON" get a error implicit declaration of functions.

sg_set_buf(mem, buf, PAGE_SIZE << order);
WARN_ON(mem->offset);

Thanks for information and learn to me.

Regards,

Ozgur Karatas

12.12.2016, 14:39, "Leon Romanovsky" <leon@xxxxxxxxxx>:
> On Mon, Dec 12, 2016 at 12:58:59PM +0200, Ozgur Karatas wrote:
>> ÂHello all,
>> ÂI think should be use to "WARN_ON" and checkpatch script give to error, I fixed and I think should don't use "BUG_ON".
>> ÂRegards,
>>
>> ÂSigned-off-by: Ozgur Karatas <okaratas@xxxxxxxxxxxxxx>
>
> NAK, Leon Romanovsky <leonro@xxxxxxxxxxxx>
>
> If we put aside commit message issue, which was pointed to you by Stefan, your
> proposed change is incorrect. By chnaging BUG_ONs to be WARN_ONs, you
> will left the driver in improper state.
>
> Thanks
>
>> Â---
>> Âdrivers/net/ethernet/mellanox/mlx4/icm.c | 4 ++--
>>
>> Âdiff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c
>> Âindex 2a9dd46..3fde535 100644
>> Â--- a/drivers/net/ethernet/mellanox/mlx4/icm.c
>> Â+++ b/drivers/net/ethernet/mellanox/mlx4/icm.c
>> Â@@ -119,7 +119,7 @@ static int mlx4_alloc_icm_coherent(struct device *dev, struct scatterlist *mem,
>> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -ENOMEM;
>>
>> ÂÂÂÂÂÂÂÂÂÂsg_set_buf(mem, buf, PAGE_SIZE << order);
>> Â- BUG_ON(mem->offset);
>> Â+ WARN_ON(mem->offset);
>> ÂÂÂÂÂÂÂÂÂÂsg_dma_len(mem) = PAGE_SIZE << order;
>> ÂÂÂÂÂÂÂÂÂÂreturn 0;
>> ÂÂ}
>> Â@@ -133,7 +133,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
>> ÂÂÂÂÂÂÂÂÂÂint ret;
>>
>> ÂÂÂÂÂÂÂÂÂÂ/* We use sg_set_buf for coherent allocs, which assumes low memory */
>> Â- BUG_ON(coherent && (gfp_mask & __GFP_HIGHMEM));
>> Â+ WARN_ON(coherent && (gfp_mask & __GFP_HIGHMEM));
>>
>> ÂÂÂÂÂÂÂÂÂÂicm = kmalloc_node(sizeof(*icm),
>> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂgfp_mask & ~(__GFP_HIGHMEM | __GFP_NOWARN),
>> Â--
>> Â2.1.4