From patchwork Mon Mar 18 20:47:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10858555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4822A1575 for ; Mon, 18 Mar 2019 20:47:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26997287C0 for ; Mon, 18 Mar 2019 20:47:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A3AE2948C; Mon, 18 Mar 2019 20:47:42 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C3A8429481 for ; Mon, 18 Mar 2019 20:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NDp+IE5USwzBloR2XmXk1SNkKw0n1s5DT3JTOujCMiU=; b=E/SwWAV60SBg/P c1NApGccrlAxIrbiyBguA7uAspiE3WaOHyVkJXEeOhCZab8YHQmOKF4sTN98w7mJtrLjPfyxrNN6o u+nXa3pfWYLA+pE3dQtawc4qUzfQcqbGbQI5oKchXIHKID60CSetezR4Rfs+5pk6PVuMb80nVj6RR +b8/lVS3r5pPZYnAQK1Srtt+POmaZ6byGN8txNShsLACQYIdsYxfnFaUjjhT+hjeUJPp1EUDVKLgG fwgbGXdT+yWl2Z0gkWSPpsgcSxpt5LXW86J+jWOtlp8GrifR67OpQxwJJrJMSbi5P0eBS++5ZRUJM wZm9xcfm85iq8VL4waMA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h5zAa-0000I1-Q7; Mon, 18 Mar 2019 20:47:40 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h5zAQ-000050-QE; Mon, 18 Mar 2019 20:47:31 +0000 Received: by mail-wm1-x343.google.com with SMTP id t124so14249683wma.4; Mon, 18 Mar 2019 13:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gTFecInQYP9wwQj812Skvi7oL3bq5LWKLMuFYZPP1Fw=; b=aWzaZ5KD2byT04qun1TNGBXfcx+En48cCP1ycdeUE8xD7chQW38vxt7jkkE/Hs78O9 FIpluGwpjRIZDbTOrh+0dzzkBI/mYBwzt3VXj1bV+o6+RANctLylQwmqv74UHzYp7Xa7 Zw5v0OWk8pPOW7oTR+Hgp/EQxj5MKmHjFostPcrdNrbyLUBbB6psN1T33l2dHEk5FfcU liIhRDgS0fRwJ7QdnxAdD8VOR+F/GOGYgLKRykWRDRCsjbyHgcI4hhqjamNbclw6wn7q EuS/w8Wh0LS/xOfxOdwGxlv1Ph8fpX6I6d0mcCOL+GUKe/ihjtYFzbM3r4CU9X+Kp87C zJUw== 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:mime-version:content-transfer-encoding; bh=gTFecInQYP9wwQj812Skvi7oL3bq5LWKLMuFYZPP1Fw=; b=CWY6+7scrY5BrkVxfzN8THyPDePEqKF2R+dwe8yd23YS0CviY27XtW6CMXrdlX3wZc 6cneFWSDxeNL/VmgfXtWj4GVa4AnCi0pBnoKl02afrPh8FsU+UClCA4KJ9PZpsTQtjjD nJUYbzmKuKZ20viZIOxflwEu5ffi/VTo/eOTNeuBy18mDvhBYNXwx5ypkN5cRLyYSW8S P4qDlQQ3Cg1Fm0iKiVvBionVJkc2vduNA1yhJ2q9LSlQF4isG+t7K3C/UeyL+sgrZEi9 LcGnAu0d6H8w2EKEE1vJshGFKzyvnKiQSy/pAdMoGa6cFmidxvlQLCVJkSxJ8OKnn1lR 7+oA== X-Gm-Message-State: APjAAAVRRF+SBgSZJ6FXpgNoyQhYHl6z/24uz/zhXc9GOLgurDkM763A zGNGrpMFrTNeeRJTPRyp1Pu2SRka X-Google-Smtp-Source: APXvYqzOc9VNDbIX90H22bol5C6f4c1+BmYF1lTwu47Lth9itBXQhxsE2FeL557FDL+RUmR2PEqSCg== X-Received: by 2002:a1c:7c0c:: with SMTP id x12mr627498wmc.38.1552942048819; Mon, 18 Mar 2019 13:47:28 -0700 (PDT) Received: from blackbox.darklights.net (p200300DCD7399900918378ACFECF051C.dip0.t-ipconnect.de. [2003:dc:d739:9900:9183:78ac:fecf:51c]) by smtp.googlemail.com with ESMTPSA id y12sm224849wma.44.2019.03.18.13.47.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Mar 2019 13:47:28 -0700 (PDT) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-mtd@lists.infradead.org, bbrezillon@kernel.org, miquel.raynal@bootlin.com Subject: [PATCH v2 1/2] mtd: rawnand: meson: add missing ENOMEM check in meson_nfc_read_buf() Date: Mon, 18 Mar 2019 21:47:21 +0100 Message-Id: <20190318204722.9901-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190318204722.9901-1-martin.blumenstingl@googlemail.com> References: <20190318204722.9901-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190318_134730_851849_9EA81FFD X-CRM114-Status: GOOD ( 10.78 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martin Blumenstingl , richard@nod.at, liang.yang@amlogic.com, linux-kernel@vger.kernel.org, jianxin.pan@amlogic.com Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP kzalloc() can return NULL if memory could not be allocated. Check the return value of the kzalloc() call in meson_nfc_read_buf() to make it consistent with other memory allocations within the meson_nand driver. Fixes: 8fae856c53500a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller") Signed-off-by: Martin Blumenstingl Acked-by: Liang Yang Reviewed-by: Kevin Hilman --- drivers/mtd/nand/raw/meson_nand.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index 3e8aa71407b5..a1d8506b61c7 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -528,6 +528,9 @@ static int meson_nfc_read_buf(struct nand_chip *nand, u8 *buf, int len) u8 *info; info = kzalloc(PER_INFO_BYTE, GFP_KERNEL); + if (!info) + return -ENOMEM; + ret = meson_nfc_dma_buffer_setup(nand, buf, len, info, PER_INFO_BYTE, DMA_FROM_DEVICE); if (ret)