Received: by 10.223.176.5 with SMTP id f5csp1198976wra; Fri, 9 Feb 2018 14:31:01 -0800 (PST) X-Google-Smtp-Source: AH8x227TKqI+ISr2Sb/Vyu22xwJKsA0sCJN24Vcx3SiU35vW15me8mMRr+WawY5KSkfcPmZj82d5 X-Received: by 2002:a17:902:57d8:: with SMTP id g24-v6mr3764984plj.27.1518215461326; Fri, 09 Feb 2018 14:31:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518215461; cv=none; d=google.com; s=arc-20160816; b=RIJUZKYK7kRrQoBiSonETuhz+3GkbW9NYVsahNuXJWHNJnPlk3RN8fPBZ6GTMzg8LN HuS00WGBHiq2QbW0rZaFSgEIlbpZtOW/yhZO+s1LD1VWOF7XatsicFpR9JU2AeJzEmgB sZPQ22sJmmzMn1cRVkEXLu8XJ2QRUp4M8f2BjVlW6u3+vuangN97s4DY08J+dq81VnPU 0Rq/ICHFlloRj9PfU8wpumiYtozjKFrbzT+NAcxr11cJWKzTDMu7ECTtB40yLzRE4O7t Rhggg59minkovEZOt6hhSZQ51fVw003yT4TbzjL61FvvOFuGY/bEN+Vxg+3Qy5n1g/xu y3LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=MptSX/gPwT/RUPRJMULEAyoXXX6GmrtJhiqsY5U1mFY=; b=b2wq/WtkIip9Q/7mrq9v8/bDcZdYyY4ROh/aTaHp33//c/ba18f/AQYuyNWeYNXWEK R85z2nmVRFyf+Nmj5YC2JzxKBCngAMbQrQnoOZ+sA59oleJu68m+s7y3OvFwLgP0mild qlUGtMhrD09lb+fE29UcNag166phzdB3bqetXcpmwKHAgmDfejBis/FE5Z0kN3OAQX7G X3J93VzNPNZRkaXBKjufgRFqVP9xMaZTBNzi4h4/gFnp397ksxKKf2xaNtdZEymCFNkQ Mved+taI7Yzlq1/u9E/vAO8CAQPDGCAScuSL4BE33VF8KQGTu7QDykvyIWuJnmPd9ZvX CJ5g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si1882529pgp.405.2018.02.09.14.30.47; Fri, 09 Feb 2018 14:31:01 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753169AbeBIW32 (ORCPT + 99 others); Fri, 9 Feb 2018 17:29:28 -0500 Received: from mail.ispras.ru ([83.149.199.45]:44522 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753124AbeBIW3P (ORCPT ); Fri, 9 Feb 2018 17:29:15 -0500 Received: from localhost.localdomain (ppp85-140-182-254.pppoe.mtu-net.ru [85.140.182.254]) by mail.ispras.ru (Postfix) with ESMTPSA id 88163540081; Sat, 10 Feb 2018 01:29:13 +0300 (MSK) From: Alexey Khoroshilov To: Boris Brezillon Cc: Alexey Khoroshilov , Stefan Agner , Richard Weinberger , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH v4 3/3] mtd: nand: vf610: check mtd_device_register() return code Date: Sat, 10 Feb 2018 01:28:36 +0300 Message-Id: <1518215316-21504-4-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518215316-21504-1-git-send-email-khoroshilov@ispras.ru> References: <1518215316-21504-1-git-send-email-khoroshilov@ispras.ru> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vf610_nfc_probe() misses error handling of mtd_device_register(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov --- drivers/mtd/nand/vf610_nfc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c index 9cc5992e88c8..64fed3d9e3d4 100644 --- a/drivers/mtd/nand/vf610_nfc.c +++ b/drivers/mtd/nand/vf610_nfc.c @@ -782,8 +782,13 @@ static int vf610_nfc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mtd); /* Register device in MTD */ - return mtd_device_register(mtd, NULL, 0); + err = mtd_device_register(mtd, NULL, 0); + if (err) + goto err_cleanup_nand; + return 0; +err_cleanup_nand: + nand_cleanup(chip); err_disable_clk: clk_disable_unprepare(nfc->clk); return err; -- 2.7.4