Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3619401imm; Sun, 10 Jun 2018 21:40:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIQ1K55vMvIsid8ccFoI8kL6ErFStWoprs5oZfuLV1mMSDF9EaS30pS6LW0Wa7Ci0taYphU X-Received: by 2002:a65:6355:: with SMTP id p21-v6mr13185456pgv.293.1528692031870; Sun, 10 Jun 2018 21:40:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528692031; cv=none; d=google.com; s=arc-20160816; b=wS/AucWXjDDj/aEyhFnvrZpvLuX0YBsnRciR4SY5uLg0pKySe150gMi/3sPHaOVxHi oQ4U2rQKT1JfmsbXRHmcc4s8j/IfsEZt7aPTZidw8+3zLqwBEmNmH1D75N3kKQTCK8i9 25lhKuP0uHib4yotJHZfR6A4jIvc1DggS0m5MdDpLXmBIWWev/cJqgbBRLJYrpucX27+ 6bUO8zIxKd+5eXzsIPW6l1a8oVFaaKoDHMDb5f+LtUJqAW9SeVmi6/tNpmfaHGPOCd86 C1cVea/hMdc4ZglY5KsjLNGcNyPuUYrMpxC26O0X7LggIwXlCKW18RYSIaK4MfLBq2rK CY0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature:arc-authentication-results; bh=/9w/5uETKNwh15sAPtYyMo+0lDixTdw3GlH3t18lCbw=; b=ArwLp1JQZQxtSHU23MNq7+/e7XI485K0eA/g8sF9CRuHNJ81bYg41/ZXJ/yNM/z4Pw qd8IzM3fkph02th06X7F9h7mZOmq/WCc1++ENh02sfDIcoRQb8d2RCLEfREDyP1NESS/ 9wh6TkahFTsdluJkw+YViILvW1t22XJWVpw7c/2jOc6ZAtOUOFaFP9o53LMLQpAaXaC5 eUk8bUvTHt9Oc8VwzA2anYdbcEful8AAIwjfrh8pAkFcmgiiUUZqbGLSrbJyyNxYFy/l SjAVQZOCtQu7j7af2G27ABU18egH6iItKosPVX7Ne9rgJMbsfzvjz/4XNb4M4QRidUEd Kitg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VB9oG6gb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23-v6si24363374plr.498.2018.06.10.21.40.17; Sun, 10 Jun 2018 21:40:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VB9oG6gb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753911AbeFKEjy (ORCPT + 99 others); Mon, 11 Jun 2018 00:39:54 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:37978 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753801AbeFKEjw (ORCPT ); Mon, 11 Jun 2018 00:39:52 -0400 Received: by mail-pl0-f65.google.com with SMTP id b14-v6so11588520pls.5; Sun, 10 Jun 2018 21:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/9w/5uETKNwh15sAPtYyMo+0lDixTdw3GlH3t18lCbw=; b=VB9oG6gb892rYInFSSq9+E+PhNl6Rkbf2lQok8E8+ZbHk0b1zItnpRvIDeafxy+OSi QKFeMH+wvO8+YZ/Vcn2vmurFJp6YrUSmGH+miwXjvxIHyRlEmWqgzzw3f3hS+oQ9YPGK kgo3mOVmYFoAuWSozQAw0UwBBolhC4KKU2TDTOR0o0sKQ6EN/KkdVPQ6wq+L+o2QPxqr IFeM8vHtU0C0FtfRfeXpBHUlF62Kowln5/S54yJyUiw5MI9da0lusITJGSa8X2VCF5CL ox5YFOLljOa96jlqiATb0oKuqWfPQFREywjHKbPys2HmSatjOrpo6DXy+Qp0ImKMhZZc 3B2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/9w/5uETKNwh15sAPtYyMo+0lDixTdw3GlH3t18lCbw=; b=U/4VE/JODllZjHS5wFb8a8jjdr1RF/giYyJpOtUe9OwoD4KR5UzZc6veKyHKVZXBi4 mZoU7MFdTe1Qr7p76xm7CyR4p5aE/o8dN5cxPByw2zgdpA1D5Q/SdI7GmQUIH6XGzK7V 4Vzn62qHPAM3YtP39mlC+AdELwOp2GvytV1Y1li7jSTrTEQktMofXC/09BFYms81VE1Q 1pv237CUSQLTFbbYoWsYLT8VYf1lYjKBLA37EtU1LFnKGNPamAjvKO09h+sEsL+MMKmv h1kB/bi0k5xx7NIPv/WAXbA/lnebAwIXGGMy6FZ97OVIWP4ZlLVsNoYekbvjInk33+G5 7dVw== X-Gm-Message-State: APt69E25C5uV9DmsYOeKbuJ1LNitjEnwYzMrtYGDYtKxx3qicOtGbLEh 1ZmKPQdNEAflTlRgNaWqjZo= X-Received: by 2002:a17:902:b946:: with SMTP id h6-v6mr16426457pls.1.1528691992111; Sun, 10 Jun 2018 21:39:52 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id d22-v6sm89976294pfk.126.2018.06.10.21.39.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jun 2018 21:39:51 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Mauro Carvalho Chehab , Markus Elfring , Hans Verkuil , Colin Ian King , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: tm6000: add error handling for dvb_register_adapter Date: Mon, 11 Jun 2018 12:39:20 +0800 Message-Id: <1528691962-31010-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When dvb_register_adapter fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling dvb_register_adapter. Signed-off-by: Zhouyang Jia --- drivers/media/usb/tm6000/tm6000-dvb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c index c811fc6..ff35d4b 100644 --- a/drivers/media/usb/tm6000/tm6000-dvb.c +++ b/drivers/media/usb/tm6000/tm6000-dvb.c @@ -266,6 +266,11 @@ static int register_dvb(struct tm6000_core *dev) ret = dvb_register_adapter(&dvb->adapter, "Trident TVMaster 6000 DVB-T", THIS_MODULE, &dev->udev->dev, adapter_nr); + if (ret < 0) { + printk(KERN_ERR "tm6000: couldn't register the adater!\n"); + goto err; + } + dvb->adapter.priv = dev; if (dvb->frontend) { -- 2.7.4