Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752672AbcLDFkQ (ORCPT ); Sun, 4 Dec 2016 00:40:16 -0500 Received: from m50-138.163.com ([123.125.50.138]:52898 "EHLO m50-138.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751888AbcLDFkO (ORCPT ); Sun, 4 Dec 2016 00:40:14 -0500 From: Pan Bian To: Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] media: pci: meye: set error code on failures Date: Sun, 4 Dec 2016 13:40:06 +0800 Message-Id: <1480830006-4839-1-git-send-email-bianpan201603@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: C9GowAAHLSU2rENY7bG1IQ--.56130S3 X-Coremail-Antispam: 1Uf129KBjvdXoWruF17tr1kXw18Jw1fJF4xWFg_yoWfuFXEga 1UZr97Zr4kKrn3Kr17tryfZryqk390g34rJr4kta9Ik3W3Aw1kA3Z0vF1DJF1q9w4IvFyD KrykXF15ur1UXjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUYqD73UUUUU== X-Originating-IP: [114.243.30.33] X-CM-SenderInfo: held01tdqsiiqwqtqiywtou0bp/1tbiKBk291WBVZhlqgAAsm Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 904 Lines: 28 From: Pan Bian The value of return variable ret is 0 on some error paths, for example, when pci_resource_start() returns a NULL pointer. 0 means no error in this context, which is contrary to the fact. This patch fixes the bug. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189011 Signed-off-by: Pan Bian --- drivers/media/pci/meye/meye.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c index ba887e8..115e141 100644 --- a/drivers/media/pci/meye/meye.c +++ b/drivers/media/pci/meye/meye.c @@ -1669,6 +1669,7 @@ static int meye_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) goto outenabledev; } + ret = -EIO; mchip_adr = pci_resource_start(meye.mchip_dev,0); if (!mchip_adr) { v4l2_err(v4l2_dev, "meye: mchip has no device base address\n"); -- 1.9.1