Message ID | 20201016185155.GA233060@nvidia.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [GIT,PULL] Please pull RDMA subsystem changes | expand |
On Fri, Oct 16, 2020 at 11:52 AM Jason Gunthorpe <jgg@nvidia.com> wrote: > > You'll need to apply this fixup to the merge commit (it is in the tag > for-linus-merged for reference): Ugh. That's unbelievably and unnecessarily ugly. There's no point in that unnecessary "ret" variable and the "goto out" etc, when all the error cases can be handled much more directly. So I resolved that merge issue somewhat differently. I can't test the end result, but it looks TriviallyCorrect(tm). Famous last words. Feel free to make fun of me and call me names if that breaks. Linus I did it v
The pull request you sent on Fri, 16 Oct 2020 15:51:55 -0300:
> git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git tags/for-linus
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/a1e16bc7d5f7ca3599d8a7f061841c93a563665e
Thank you!
On Sat, Oct 17, 2020 at 11:21:51AM -0700, Linus Torvalds wrote: > On Fri, Oct 16, 2020 at 11:52 AM Jason Gunthorpe <jgg@nvidia.com> wrote: > > > > You'll need to apply this fixup to the merge commit (it is in the tag > > for-linus-merged for reference): > > Ugh. That's unbelievably and unnecessarily ugly. > > There's no point in that unnecessary "ret" variable and the "goto out" > etc, when all the error cases can be handled much more directly. Yep > So I resolved that merge issue somewhat differently. I can't test the > end result, but it looks TriviallyCorrect(tm). > > Famous last words. Feel free to make fun of me and call me names if that breaks. Not familiar with DRM land, but it looks trivially fine to me too. Thanks, Jason
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 11fe9ff76fd572..8ee53839825338 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -807,6 +807,7 @@ struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev, struct page **pages, unsigned int nr_pages) { struct sg_table *sg = NULL; + struct scatterlist *sge; size_t max_segment = 0; int ret; @@ -820,11 +821,13 @@ struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev, max_segment = dma_max_mapping_size(dev->dev); if (max_segment == 0 || max_segment > SCATTERLIST_MAX_SEGMENT) max_segment = SCATTERLIST_MAX_SEGMENT; - ret = __sg_alloc_table_from_pages(sg, pages, nr_pages, 0, - nr_pages << PAGE_SHIFT, - max_segment, GFP_KERNEL); - if (ret) + sge = __sg_alloc_table_from_pages(sg, pages, nr_pages, 0, + nr_pages << PAGE_SHIFT, max_segment, + NULL, 0, GFP_KERNEL); + if (IS_ERR(sge)) { + ret = PTR_ERR(sge); goto out; + } return sg; out: