lkml.org 
[lkml]   [2022]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next 9/9] net: ipa: use a bitmap for enabled endpoints
On Sat, 29 Oct 2022 19:18:28 -0500 Alex Elder wrote:
> /* Set up the defined endpoint bitmap */
> ipa->defined = bitmap_zalloc(ipa->endpoint_count, GFP_KERNEL);
> ipa->set_up = bitmap_zalloc(ipa->endpoint_count, GFP_KERNEL);
> + ipa->enabled = bitmap_zalloc(ipa->endpoint_count, GFP_KERNEL);
> if (!ipa->defined || !ipa->set_up) {

This condition should now check if ipa->enabled

And the error handling patch needs to free it, in case it was something
else that didn't get allocated?

Frankly I have gotten mass-NULL-checks wrong more than once myself so
I'd steer clear of those, they are strangely error prone.

> dev_err(dev, "unable to allocate endpoint bitmaps\n");

this error message should not be here (patch 5 adds it I think)
memory allocation failures produce a splat, no need to print errors

> + bitmap_free(ipa->set_up);
> + ipa->set_up = NULL;
> bitmap_free(ipa->defined);

\
 
 \ /
  Last update: 2022-11-02 05:35    [W:0.065 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site