Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2414546imm; Mon, 16 Jul 2018 07:40:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcMTUccqC55kxYhMoxItVW0R1XiGYIgxf6xGmPi0OMBaVMNGZjILqt7VxTrM9SmQZ5RCyDN X-Received: by 2002:a63:2fc6:: with SMTP id v189-v6mr15724832pgv.61.1531752055934; Mon, 16 Jul 2018 07:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531752055; cv=none; d=google.com; s=arc-20160816; b=G3mJnC5vpyAtSUmaZmDUvK7ZgTm0LdYvtVmk5uN97kI1jHK7Ztmrmu63xpsMRVKqWU pLXqvSFt0OFKS2HvF8Idz3QLvNwTWJ+Y7g/QootOjxYzhLOq7r0skRA2rBYzGLPegkvR T8+F3JI1OInmmmAezUh4+zkOSgHT9BW6/kYPMPF93IZm41lHp/qhM6AVSxLgpPfAVULl zWUCBo38Ji/6CXm67J2f6BSlj+6Lqx6QA4arXWS6THhfim6wg33xhyXzSc1VFHS1isMP G/TaEpUbK04rt17apKifACkTbtoTHXiWhiNPwUwPq7/9727sZcvxBcigRm+rynM7tvHH KjAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=j1U2p8MyroRxhi7NG/UQ91LVLaDxg/OWCjfHgw/lobw=; b=ZqjB2Lb7YCP5FusDyJdWRg5daBAhD+27fdEPGJkFnjPzaXupVDNQ6pGymG8iDH3sde pBRBBXUA/khKg+Sjr9OeIzF8UIe9Ex1UpP4/YusE45XIAjvZ3KD9OP6049QW6A2YB2Ki uUG5Z+PTdmlo6KlQMa3bQv1FC2Z/dwjk2KDPiyBYCt3JEjI6ej6UMRh9CmlJuAzTP8yI HSFZB3nbYEHkHocrqiYdp/GFjFqWBzlW/j9RcNWCv/L0d/lpzA2vPRvRSqVkkv40Y6Yx 27lAK38at7JhvJbv2kfENCu/mCjvywlfyKkOyl7kfvLfn/hS5Yyjj8HyPxQ/UmOcX2TX f6lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DAHPGAfo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9-v6si30829401pla.377.2018.07.16.07.40.41; Mon, 16 Jul 2018 07:40:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DAHPGAfo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729474AbeGPPHE (ORCPT + 99 others); Mon, 16 Jul 2018 11:07:04 -0400 Received: from mail-yb0-f195.google.com ([209.85.213.195]:44431 "EHLO mail-yb0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727411AbeGPPHE (ORCPT ); Mon, 16 Jul 2018 11:07:04 -0400 Received: by mail-yb0-f195.google.com with SMTP id b21-v6so1379690yba.11 for ; Mon, 16 Jul 2018 07:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=j1U2p8MyroRxhi7NG/UQ91LVLaDxg/OWCjfHgw/lobw=; b=DAHPGAfozspxj/u8IcvQNhqxkbH8vEVefrcYkA/oegr5tz1UODcXJudECPLPrTDxTp paKZgz1oFMYEninCG8RjifJ798il5Iz08szX7Il4ZyFGGBkbaFHraE0H21jjAlu/z+jP 3rL81/LQTzyChMIwGJxr3RqR6Eb51+XQPD/uA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=j1U2p8MyroRxhi7NG/UQ91LVLaDxg/OWCjfHgw/lobw=; b=IkFQZw3MS99bWq29tEOEP+F315F3xf71aZeu8SsHNrOkhKxHBqFQK7PQErxomnJczZ jmovEcV6dlHWMg4UkYe70tPWf2gVPvZ1hQaOWd6b8D6JTNZYzlek405ElQqPXDedYzAc MVpJ6h5YdHdUxo7nyHEu1ZCuHhqCBDs5ltgqpzw5mBVFxeZwgLktr0DriZG4ul1L6FW4 t3k7XKRaMoToXzl4AEM5HQOkhpd+YQDwgFXlzeNxQWkdPXv7KynqEsip1yWQ89NDAbnL 4qSrn1U9eP8JFj1Si+PQVNp1OfXXTEh0SZV9EiWFkDQKIq53AM+fUGfeotZORNvzkrgF rdQA== X-Gm-Message-State: AOUpUlH5YOcXLPCKHehL3fTbx77J7iUtcKLsahgkIfr+G2zF+v/CepP+ hN5fj/CunEM5YWCyGOkWw2Y7LA== X-Received: by 2002:a25:854f:: with SMTP id f15-v6mr8888695ybn.119.1531751960020; Mon, 16 Jul 2018 07:39:20 -0700 (PDT) Received: from localhost ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id r132-v6sm18780834ywb.0.2018.07.16.07.39.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 07:39:19 -0700 (PDT) Date: Mon, 16 Jul 2018 10:39:18 -0400 From: Sean Paul To: Nicholas Mc Guire Cc: Gustavo Padovan , Maarten Lankhorst , Sean Paul , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm: re-enable error handling Message-ID: <20180716143918.GT20303@art_vandelay> References: <1531571532-22733-1-git-send-email-hofrat@osadl.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1531571532-22733-1-git-send-email-hofrat@osadl.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 14, 2018 at 02:32:12PM +0200, Nicholas Mc Guire wrote: > drm_legacy_ctxbitmap_next() returns idr_alloc() which can return > -ENOMEM, -EINVAL or -ENOSPC none of which are -1 . but the call sites > of drm_legacy_ctxbitmap_next() seem to be assuming that the error case > would be -1 (original return of drm_ctxbitmap_next() prior to 2.6.23 > was actually -1). Thus reenable error handling by checking for < 0. > > Signed-off-by: Nicholas Mc Guire Thanks for your patch, I've applied it to drm-misc-fixes. Sean > Fixes: 62968144e673 ("drm: convert drm context code to use Linux idr") > --- > > Problem located with experimental coccinelle script > > The noted Fixes tag is one of the commits that removed the -1 return > value in 2.6.23 in drm_ctxbitmap_next() but thats not the only change > that must have taken place to invalidate the error check. > > Patch was compile tested with: x86_64_defconfig > > Patch is against 4.18-rc4 (localversion-next is next-20180713) > > drivers/gpu/drm/drm_context.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c > index 3c4000f..f973d28 100644 > --- a/drivers/gpu/drm/drm_context.c > +++ b/drivers/gpu/drm/drm_context.c > @@ -372,7 +372,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data, > ctx->handle = drm_legacy_ctxbitmap_next(dev); > } > DRM_DEBUG("%d\n", ctx->handle); > - if (ctx->handle == -1) { > + if (ctx->handle < 0) { > DRM_DEBUG("Not enough free contexts.\n"); > /* Should this return -EBUSY instead? */ > return -ENOMEM; > -- > 2.1.4 > -- Sean Paul, Software Engineer, Google / Chromium OS