From patchwork Tue Apr 11 04:32:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 749332 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3w2Dhb5x09z9sNS for ; Tue, 11 Apr 2017 14:33:51 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751966AbdDKEds (ORCPT ); Tue, 11 Apr 2017 00:33:48 -0400 Received: from smtp04.smtpout.orange.fr ([80.12.242.126]:53342 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751587AbdDKEds (ORCPT ); Tue, 11 Apr 2017 00:33:48 -0400 Received: from localhost.localdomain ([92.140.231.172]) by mwinf5d60 with ME id 6sZk1v00N3jptJL03sZkB7; Tue, 11 Apr 2017 06:33:46 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 11 Apr 2017 06:33:46 +0200 X-ME-IP: 92.140.231.172 From: Christophe JAILLET To: kurt.schwemmer@microsemi.com, stephen.bates@microsemi.com, logang@deltatee.com, bhelgaas@google.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] switchtec: Fix an error handling Date: Tue, 11 Apr 2017 06:32:04 +0200 Message-Id: <20170411043204.19343-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 'stuser_create' returns an error pointer in case of error, not NULL. So test its return value with IS_ERR. Fixes: 74004262f329 ("MicroSemi Switchtec management interface driver") Signed-off-by: Christophe JAILLET Reviewed-by: Logan Gunthorpe --- drivers/pci/switch/switchtec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index fcde98161d9a..cc6e085008fb 100644 --- a/drivers/pci/switch/switchtec.c +++ b/drivers/pci/switch/switchtec.c @@ -608,7 +608,7 @@ static int switchtec_dev_open(struct inode *inode, struct file *filp) stdev = container_of(inode->i_cdev, struct switchtec_dev, cdev); stuser = stuser_create(stdev); - if (!stuser) + if (IS_ERR(stuser)) return PTR_ERR(stuser); filp->private_data = stuser;