Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp294034ybz; Tue, 28 Apr 2020 23:54:35 -0700 (PDT) X-Google-Smtp-Source: APiQypKkmAwtmWsfoDXqOEoKCLaHZcbJ12CxMS1nIpPhiVXZGOoK3zlL9sFsYjO5LhzQUCbJPX5d X-Received: by 2002:a50:b285:: with SMTP id p5mr1184538edd.150.1588143274981; Tue, 28 Apr 2020 23:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588143274; cv=none; d=google.com; s=arc-20160816; b=lNxLEEdVPKZJhTff2SFkf6Mo2Y6KmC2d38/+xVl0vKANRYJ0bVdFpGYa1TZR6dPuGx QMJXauxc5qovRsLAyMkKReWRiolhwveeTmIITXxlSkkKl45tLp+1oqmgY9VahULnmg6V c+fnouyBaK0pSAjPPiTPYp0C6aYRlUkN82XHdQdx0UlwYZlYyWt9PpQEHvBgd1QpQ68F 6JgGo3c0zuRcciElQlgfS+X35nBzpkX2CzJodaKEFtbExJ7Mz0bjgsNgqChRR1NHOWuC e9dDI21YKPAbIOrhJHfRaykoOkFHPdfTchE+zgL82bmRbsIG4wRhZ67WlO9OI1wwO4m4 2Jug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lEIl6ycOldivwhHoxjEYo0Cb4/kryw5XtrLU3dL32bY=; b=zxbaxsUHP+URMtGCUCBzw54WJwchKfyyOsrDll+FVyOIFgaGpy9/tNxIjZ5YSy5J13 jdZ9YS9z4V9Qj0m4irm13ZDV0nhd6LUOqFKlfSCF8xAFcSP5By4atG13dVES5OQrzfmz S5dOuDUDnGleTs6X7/eWkYan/GXZ8apDPQCoJaVfa9wysLMixHTiOxbtuUslRIn6810r WbUphQ8QfnzTG9FTvg59Yw3uG4VAh5xMBL5W/0ejwbc3X0ImNxRmTtFAvS5U3tz6jNHU oabAFqStl7yhH9WjAB/PEZRkWGLZKkn0RR2Ht8JuG98nDAgD/8j+4vgIUJZlvVPLaDe9 YiwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y23si3020380edt.99.2020.04.28.23.54.12; Tue, 28 Apr 2020 23:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726692AbgD2Gwj (ORCPT + 99 others); Wed, 29 Apr 2020 02:52:39 -0400 Received: from smtp09.smtpout.orange.fr ([80.12.242.131]:49432 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726508AbgD2Gwj (ORCPT ); Wed, 29 Apr 2020 02:52:39 -0400 Received: from localhost.localdomain ([92.148.159.11]) by mwinf5d18 with ME id YWsd2200H0F2omL03WsdMR; Wed, 29 Apr 2020 08:52:38 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 29 Apr 2020 08:52:38 +0200 X-ME-IP: 92.148.159.11 From: Christophe JAILLET To: richard.gong@linux.intel.com, gregkh@linuxfoundation.org, atull@kernel.org Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 1/4 v2] firmware: stratix10-svc: Fix genpool creation error handling Date: Wed, 29 Apr 2020 08:52:34 +0200 Message-Id: <660774ee8e63c03cb93a24d605c381eb0dce3b67.1588142343.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'svc_create_memory_pool()' returns an error pointer on error, not NULL. Fix the corresponding test and return value accordingly. Move the genpool allocation after a few devm_kzalloc in order to ease error handling. Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver") Signed-off-by: Christophe JAILLET --- drivers/firmware/stratix10-svc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c index d5f0769f3761..3a176e62754a 100644 --- a/drivers/firmware/stratix10-svc.c +++ b/drivers/firmware/stratix10-svc.c @@ -997,10 +997,6 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev) if (ret) return ret; - genpool = svc_create_memory_pool(pdev, sh_memory); - if (!genpool) - return -ENOMEM; - /* allocate service controller and supporting channel */ controller = devm_kzalloc(dev, sizeof(*controller), GFP_KERNEL); if (!controller) @@ -1011,6 +1007,10 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev) if (!chans) return -ENOMEM; + genpool = svc_create_memory_pool(pdev, sh_memory); + if (IS_ERR(genpool)) + return PTR_ERR(genpool); + controller->dev = dev; controller->num_chans = SVC_NUM_CHANNEL; controller->num_active_client = 0; -- 2.25.1