From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CF56C2D0C6 for ; Fri, 27 Dec 2019 16:02:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0AE6E20882 for ; Fri, 27 Dec 2019 16:02:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bQHtnzRW"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="KWOOycTe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AE6E20882 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HdSt6uThSAvybOvt5zCgg7jYNCqkbINyflucZMylYVA=; b=bQHtnzRWXA6F9O ciKo2GXbPhweyz8VYMXT+kNVG4lC0lPuhJVCYzwzv6aPra6nEU1yNrnmVdLvKhSkZy6hRyZa3qWSh j5ReTRQ8lsznilOrumKj36EKy5X5mTAiXsMHKQr6qjzfqn6neRd/5wmx+sMjqojWheJqLiLqxjwTW blgPSLUpObref5qaZhmoHM5gctwCd7wh+z31gcS19ROgcyIBw0oQEEe/XD2QKZwKNoI17qd0GEq7B mR3r77Yp3ttp51whWMOfUznjiaFxNjisOnhc+UyhqvC4dd7nhggfO47lOzCPZWWN4Hu0ZK1uzjSrk q3E2f0NGPNspe4+CDO8w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iks3v-0007II-0B; Fri, 27 Dec 2019 16:02:03 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iks3r-0007HM-2h for linux-arm-kernel@lists.infradead.org; Fri, 27 Dec 2019 16:02:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oC1oWMRNSivJvaHH6O8/h96cNGNhL9U+Xzh7qNQOqwE=; b=KWOOycTeiM4eLSlZofOZDcCjb ZXnWKSozQ8RV3OcmKTHktUd8FSpUfMbmc+bfk4CCR0W1c1IDfzT/x3JXjikjx/XaKbnJAPSo0Ka0/ EXG5Pm5AS6CnhCxBFbo1zVve3r6Cq69QUW/YP/NivR4wL+IjEyoazDP72+sKyO0L+KFrS4VAXLPrI 0irnNFgsslxCSLJheD77hRnFe4svwvyRiQxLM3gEjedlae17f4oLt56uywQHGUu6RYSaT5+Ut8cHz 9e4VkGSxeD/6Aitv1R+iG7LLyLGM/YF5PGw+/7aPw8vdPJ3uH092lX/FNz/MfLlJ4KkcB2dvR0qxC NTjWdsYVg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:58690) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1iks3d-0002RL-Ao; Fri, 27 Dec 2019 16:01:48 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1iks3b-0004sG-0o; Fri, 27 Dec 2019 16:01:43 +0000 Date: Fri, 27 Dec 2019 16:01:42 +0000 From: Russell King - ARM Linux admin To: Gen Zhang Subject: Re: [PATCH] board-dm644x-evm: fix 2 missing-check bugs in evm_led_setup() Message-ID: <20191227160142.GW25745@shell.armlinux.org.uk> References: <20191227023921.GA21233@zhanggen-UX430UQ> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191227023921.GA21233@zhanggen-UX430UQ> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191227_080159_567139_F3B8C76E X-CRM114-Status: GOOD ( 12.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bgolaszewski@baylibre.com, nsekhar@ti.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Dec 27, 2019 at 10:39:21AM +0800, Gen Zhang wrote: > In evm_led_setup(), the allocation result of platform_device_alloc() and > platform_device_add_data() should be checked. > > Signed-off-by: Gen Zhang > --- > diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c > index 9d87d4e..9cd2785 100644 > --- a/arch/arm/mach-davinci/board-dm644x-evm.c > +++ b/arch/arm/mach-davinci/board-dm644x-evm.c > @@ -352,15 +352,20 @@ evm_led_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c) > * device unregistration ... > */ > evm_led_dev = platform_device_alloc("leds-gpio", 0); > - platform_device_add_data(evm_led_dev, > + if (!evm_led_dev) > + return -ENOMEM; > + status = platform_device_add_data(evm_led_dev, > &evm_led_data, sizeof evm_led_data); > + if (status) > + goto err; > > evm_led_dev->dev.parent = &client->dev; > status = platform_device_add(evm_led_dev); > - if (status < 0) { > - platform_device_put(evm_led_dev); > - evm_led_dev = NULL; > - } > + if (status) > + goto err; > +err: > + platform_device_put(evm_led_dev); > + evm_led_dev = NULL; Please look again at the above change very closely. You will want to send an updated patch. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel