lkml.org 
[lkml]   [2023]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v7 2/5] media: platform: visconti: Add Toshiba Visconti Video Input Interface driver
From
On 2023-08-21 14:19, Laurent Pinchart wrote:
[...]
>>>> + viif_dev->tables =
>>>> + dma_alloc_wc(dev, sizeof(struct viif_table_area), &tables_dma, GFP_KERNEL);
>>>> + if (!viif_dev->tables) {
>>>> + dev_err(dev, "dma_alloc_wc failed\n");
>>>
>>> Are you sure DMA memory allocation errors shall be printed?
>>
>> Printing this error is useless for users in general?
>> If so, I'll drop this debug output.
>
> Failures to allocate memory in the kernel generally result in warning
> messages being printed by the allocation function, so there's no need to
> do so manually in drivers. This being said, I check dma_alloc_wc()
> (which is a wrapper around dma_alloc_attrs()), and unless I'm missing
> something, it can return NULL without printing any error. I don't know
> if this is an oversight in some code paths taken by dma_alloc_attrs() or
> if it's on purpose. Maybe Christoph, Marek or Roben will known.

Yeah, there might be a few edge cases, but in most cases
dma_alloc_attrs() will end up falling back to the page allocator as a
last resort if all the more preferred allocation options fail, and thus
complete failure should eventually cause that to scream unless
DMA_ATTR_NO_WARN was specified.

Thanks,
Robin.

\
 
 \ /
  Last update: 2023-08-21 15:36    [W:1.037 / U:0.832 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site