From patchwork Thu Jun 14 09:23:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaejoong Kim X-Patchwork-Id: 10463711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD95A603B4 for ; Thu, 14 Jun 2018 09:24:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF45428A92 for ; Thu, 14 Jun 2018 09:24:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B41E828A97; Thu, 14 Jun 2018 09:24:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D22828A92 for ; Thu, 14 Jun 2018 09:24:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754636AbeFNJYO (ORCPT ); Thu, 14 Jun 2018 05:24:14 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:46673 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754664AbeFNJYN (ORCPT ); Thu, 14 Jun 2018 05:24:13 -0400 Received: by mail-pf0-f196.google.com with SMTP id q1-v6so2926715pff.13 for ; Thu, 14 Jun 2018 02:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6OmpVlmp+YZzMVCUx+1NYq0CmbfpEqlR5PtedurMRtM=; b=BAOaVI589upCPRGkRHujq17j7b2Qzt3UXwRr5CdzVlIGOUhykTSOG2vAmHBbI7rmKA 6NhKMyKssQo1R5TiZfAWbEfIlsp+hfJYd90Ur7wXi5leuNSs3knSWjIIR3pgM7gipg2r RnSJMobqmKZiJ081PunXOykfjQhHXkTLsLu6gmmkoXz2bUf8MkSi8+haHhxl/FG6aLLb VhyEzxsHSRCuXn+MO0k75a+g0MahBuzzKNvN8cepyakfHPfNMfDVAobW+3vQzCeBVZFe tc/iXIYRuzd9ni7lDP0bIhl8DPZcX9oSUrbkPj9Gc7OjandZpO1WzOyeDGJGYOOK3qwG uREQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6OmpVlmp+YZzMVCUx+1NYq0CmbfpEqlR5PtedurMRtM=; b=n3qcojo2xkTj3mje/nSUBZsLxNrBUc9oNgXe6M5yW5XDWZtEU1LaNkohRhiTlqqUC2 P/DfFpocb7AfTCf1rbGe5P9AVo37XrtkQkKvzWEhB+NYu3rW50jZtT0mXDEEZOb3kAXF Q2hjM759wWe58QTngI7xewboqX0jju29O2m22+jnglYpWWQuyTje7HcLS6AaLV1/WRIU XlOJ60YND8ewUkHF+9qO7gD3PotVABoBrQ7ocSUpykDTrkK0w6xnGn4J6zYPuManL0E8 KZDBF5eblmxU9ouxHhsY19N0b6uGS5GcxBv2uYO8z1A+rWaU440EvmwehdDX5LEBQINz KLxQ== X-Gm-Message-State: APt69E0T4UJKwfN0L4lbY+kO6FKCzYhShbt2zT9FKT5XnS4wz9PXzuss AFjEbB2vEhN5jJoaBc7Y6qo= X-Google-Smtp-Source: ADUXVKIZ9fMqZHqR4khluvBrmJ5V2GPEIy/2O7vekgd+zkeIsClQB6NiCmrDSCEnfJGC56GyV7mdNw== X-Received: by 2002:a62:ecdb:: with SMTP id e88-v6mr8801330pfm.16.1528968251343; Thu, 14 Jun 2018 02:24:11 -0700 (PDT) Received: from climb.lge.net ([27.122.242.77]) by smtp.gmail.com with ESMTPSA id m10-v6sm5512040pgq.89.2018.06.14.02.24.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jun 2018 02:24:10 -0700 (PDT) From: Jaejoong Kim To: Felipe Balbi , Greg Kroah-Hartman , Krzysztof Opasiak , Alan Stern Cc: linux-usb@vger.kernel.org Subject: [PATCH 2/3] usb: gadget: storage: Add error handling for no memory Date: Thu, 14 Jun 2018 18:23:58 +0900 Message-Id: <1528968239-2447-3-git-send-email-climbbb.kim@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528968239-2447-1-git-send-email-climbbb.kim@gmail.com> References: <1528968239-2447-1-git-send-email-climbbb.kim@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP fsg_common_set_num_buffers() may fail due to ENOMEM. So add error handling for fail case. Signed-off-by: Jaejoong Kim Acked-by: Alan Stern Acked-by: Michal Nazarewicz --- drivers/usb/gadget/function/f_mass_storage.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c index 83eeafe..b6e2930 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c @@ -3308,7 +3308,9 @@ static ssize_t fsg_opts_num_buffers_store(struct config_item *item, if (ret) goto end; - fsg_common_set_num_buffers(opts->common, num); + ret = fsg_common_set_num_buffers(opts->common, num); + if (ret) + goto end; ret = len; end: