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: 9674549 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BB3A260382 for ; Tue, 11 Apr 2017 04:33:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B70228450 for ; Tue, 11 Apr 2017 04:33:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D0802849F; Tue, 11 Apr 2017 04:33:51 +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=-6.4 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2562D28450 for ; Tue, 11 Apr 2017 04:33:51 +0000 (UTC) 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 X-Virus-Scanned: ClamAV using ClamSMTP '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;