On Fri, Dec 20, 2013 at 07:05:10AM +0100, Daniel Vetter wrote: > On Fri, Dec 20, 2013 at 12:22 AM, Ben Widawsky > <benjamin.widaw...@intel.com> wrote: > > ctx = i915_gem_context_get(file->driver_priv, args->ctx_id); > > - if (IS_ERR(ctx)) { > > + if (IS_ERR_OR_NULL(ctx)) { > > We now have half the callers check for IS_ERR and the others not. > Afaics i915_gem_context_get can only return NULL or a real context > though. Also from a quite read the expected error for a lookup failure > is ENOENT (and there seems to be a testcase for this). > -Daniel
To your first point: I think checking null is always the right thing currently, but for future proofing, IS_ERR_OR_NULL is really the right thing. After his patch, I believe only i915_gem_context_destroy_ioctl is still incorrect. To the second: This is only based on my memory, so feel free to change whatever you need. When I retuned -ENXIO, the test failed. It should be: return ctx ? PTR_ERR(ctx) : -ENOENT; I had return ctx ? PTR_ERR(ctx) : -ENXIO; which made the subtest fail. However, as we've noted, this itself was not correct. Try the return above. -- Ben Widawsky, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx