From patchwork Fri Oct 17 17:09:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 38921 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4AD3D202DB for ; Fri, 17 Oct 2014 17:11:11 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e51sf792806eek.11 for ; Fri, 17 Oct 2014 10:11:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=PH7jT7Cl2S7cRMikZiuXgnAsXT2gEoOkgoCkpqhbmdo=; b=X6duKq4kSRNAvEXzC+spnMXXigbuRh7FLqDA2QML3R9nf/iu7YzZxQtIdHcKIGUPD6 ADCLfl7VirJrhxpNZOuDU7PLPs3107YDpYI6QdC1ADTb7KfSEC68ZySCdJ4VFFieiye/ b59lUL5JqijOPqs9QlJiN4PeT0+23liHueOOyDBZdxDk0Pad7ai2lFUugDlw40FKmw8Z OI+FyrykXW+ffClL3f3iIJJmdy9TSuMitWslc4buiwXIlwB6byWwf1yXHLXeMEBOvuuj WkUcF7K0oMF0SkURen+w1t/8GVKhpA0DjHy9Nxyx1zbjFsVHhEv9KgJWadVzPo/++ebU ehaw== X-Gm-Message-State: ALoCoQmrgKZo2b475lvTwQebdWpzFsGGnxWXsrVhp5/Cz7vnI5lTbMdA6mi+X45hkRuJ3IWphk6s X-Received: by 10.112.141.230 with SMTP id rr6mr1601822lbb.4.1413565870349; Fri, 17 Oct 2014 10:11:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.131 with SMTP id w3ls304009lad.79.gmail; Fri, 17 Oct 2014 10:11:10 -0700 (PDT) X-Received: by 10.152.204.103 with SMTP id kx7mr10234135lac.7.1413565870211; Fri, 17 Oct 2014 10:11:10 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id m1si2903169laj.133.2014.10.17.10.11.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 10:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gq15so1049051lab.26 for ; Fri, 17 Oct 2014 10:11:10 -0700 (PDT) X-Received: by 10.112.97.135 with SMTP id ea7mr10328812lbb.46.1413565870132; Fri, 17 Oct 2014 10:11:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp266838lbz; Fri, 17 Oct 2014 10:11:09 -0700 (PDT) X-Received: by 10.68.68.131 with SMTP id w3mr3013253pbt.162.1413565868364; Fri, 17 Oct 2014 10:11:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si1689853pdo.55.2014.10.17.10.11.07 for ; Fri, 17 Oct 2014 10:11:08 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753482AbaJQRKX (ORCPT + 3 others); Fri, 17 Oct 2014 13:10:23 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:43992 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753292AbaJQRKW (ORCPT ); Fri, 17 Oct 2014 13:10:22 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9HHALxg007451 for ; Fri, 17 Oct 2014 12:10:21 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHALVa023104 for ; Fri, 17 Oct 2014 12:10:21 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Fri, 17 Oct 2014 12:10:21 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAKOD026937; Fri, 17 Oct 2014 12:10:21 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH 06/28] usb: gadget: function: uvc: conditionally dequeue Date: Fri, 17 Oct 2014 12:09:42 -0500 Message-ID: <1413565804-13061-7-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.GIT In-Reply-To: <1413565804-13061-1-git-send-email-balbi@ti.com> References: <1413565804-13061-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We shouldn't try to dequeue a NULL pointer. Signed-off-by: Felipe Balbi --- drivers/usb/gadget/function/uvc_video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index c3e1f27..9cb86bc 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c @@ -352,7 +352,8 @@ int uvcg_video_enable(struct uvc_video *video, int enable) if (!enable) { for (i = 0; i < UVC_NUM_REQUESTS; ++i) - usb_ep_dequeue(video->ep, video->req[i]); + if (video->req[i]) + usb_ep_dequeue(video->ep, video->req[i]); uvc_video_free_requests(video); uvcg_queue_enable(&video->queue, 0);