lkml.org 
[lkml]   [2020]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] media: media-request: Fix crash according to a failed memory allocation
From
Date
> …, reorder media_request_alloc() such that …

Wording adjustments:
…, reorder statements in the implementation of the function “media_request_alloc” so that …


> … the last step thus

… the last step.
Thus media_request_close() …


Would you like to add the tag “Fixes” to the commit message?



> +++ b/drivers/media/mc/mc-request.c
> @@ -296,9 +296,18 @@ int media_request_alloc(struct media_device *mdev, int *alloc_fd)
> if (WARN_ON(!mdev->ops->req_alloc ^ !mdev->ops->req_free))
> return -ENOMEM;
>
> + if (mdev->ops->req_alloc)
> + req = mdev->ops->req_alloc(mdev);
> + else
> + req = kzalloc(sizeof(*req), GFP_KERNEL);

How do you think about to use a conditional operator?

+ req = (mdev->ops->req_alloc
? mdev->ops->req_alloc(mdev)
: kzalloc(sizeof(*req), GFP_KERNEL));


Regards,
Markus

\
 
 \ /
  Last update: 2020-06-21 14:47    [W:0.075 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site