Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4921554imm; Mon, 11 Jun 2018 22:48:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIqer5IbKF5h0duJgz11XKxWd27/dqfDfMlB7ZbPS3N9qdlrOfMNey7xATUYWVvOdZTXbor X-Received: by 2002:a17:902:b60c:: with SMTP id b12-v6mr2489977pls.44.1528782485976; Mon, 11 Jun 2018 22:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528782485; cv=none; d=google.com; s=arc-20160816; b=OkUfdtfolUStXKCApgx5WqPUaUifXD2gG5BvrtLIuuzt7eS2IsmXL46v5wwJU+iQxk 8BvvazPQYlsMpChG7VrPX1X56v1jDc+l5EY/49mn/l83SW4IaQWzSd7A6teTIXn1X4EX JW2E3xiB5nuYVhOMaI44+7iButF4T/W5jCdxrmQvunQyaTG/nTBEB9bXMopPh9KnQaRK IGE1ADNYX4/uoZkzSMkI5fVFwYiyTytmQS3ajeHdsQug7LA9hp0oERgecki6nzlFLfb/ AOex4sVzTpugOcr3De2ct4uABcX/CAjMdFQ8zALKjlefa3vt4n0P4E0WfNdaPd3AxIfx pyxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:dkim-signature:arc-authentication-results; bh=RvT1QbMntoujOsymkKNfMFzuy919lC9/dZnzAnll76g=; b=lLmKjosaVrH9ZADveUIcszugcjnRPehWrjJj4yi5ziS5ZZcn5rsIYpoyEDgstCcY8X jerI8qz7nTJY2CCocxH7iopfdVq//4RsyOyrHzfZwvA+xT0Tq+JMjnabeCmTT2cRhd+r sSCruQK5fC1BVmenPRHCuITCoy0YX7OLR1PHLk2MoKKiamWa3KFszeG74F/ohVVFznz3 /j0nO8KbuuhCrQev7OcCzY4+RjqfSkKX4b+c9jL2vuj00RC0hoGIK9Q51VsHL7f3J5G/ cMkdMFgbfRrAkP+ASSCtQuS0AAnOvx+S4lPZ31S/npNBboSnbS28wO8CnxbDddxGjlxI qK8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=rt3NrHbw; 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 i1-v6si81920plt.183.2018.06.11.22.47.51; Mon, 11 Jun 2018 22:48:05 -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=rt3NrHbw; 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 S1754111AbeFLFra (ORCPT + 99 others); Tue, 12 Jun 2018 01:47:30 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:46334 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751615AbeFLFr3 (ORCPT ); Tue, 12 Jun 2018 01:47:29 -0400 Received: by mail-pg0-f67.google.com with SMTP id d2-v6so10906182pga.13; Mon, 11 Jun 2018 22:47:29 -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:in-reply-to:references; bh=RvT1QbMntoujOsymkKNfMFzuy919lC9/dZnzAnll76g=; b=rt3NrHbwqtL6+y4VtOUROz4GNYT1zydo6/ffPog2nwNqKuXqiJ90hkL2YuKtVjZ8dh YTI5HQa6eEf0pKU6jfpNq/c8yZZCijdtns1yiqtrAEH6b/o2WPIkzbGz4xsEch50eji2 eAyltWOXrf5p9G2WfwEWFnIo4CYXhCFenx/Bpe9TmoIEgwr17THHdP2Trh4d73onzJEf oxTdUYMjNHa1M6JyYt5UPrNHPN05PGkTKPpHYSZoXFecrDq31XNIEzZZXSkU95Q2Qx8k qR3fH241ogJWv2o7T/ZQtjFIDlSWoJvHkX0aAnrpe0MXZycHSm6jf79qzQ5QRo/6PuOp iwag== 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:in-reply-to :references; bh=RvT1QbMntoujOsymkKNfMFzuy919lC9/dZnzAnll76g=; b=XXoZX8khz3dI5A5T6H65juNT9vq+7mi7M3KE3bQ40w62iWDlUiSyd6kRx16a54AW5U WBQrokmiupGWGU0RAkYF8H9BU4IDvI371j33L6f96nSqwLgZgQu3PR+HflnZQhH8XM3S lqifh01K4mvb5pGZh7ADJSUXC1iu32/f1baLnUI19g1LHFHnN0qUZ+n33Jg+Rf6/HoOo 0rA5lxy8hJyRBzSz31cYk1kRHfQHOyAxJYJ3+U7aKlwrazFCynddGVXJSOH8S82qJUUe LtulAC3wqtBINqFLAU3IJ4qDFXQdbLE48uIW+e4LV2g5SL850fjAGrGyWDieF+V4Yuyk Wirg== X-Gm-Message-State: APt69E1//j2YsAVKBZJiVFydEJR4vRGSngwT5/DC61VFrn/h4/orvbg2 XBvUSQd3XzTkNYFmawSq88c= X-Received: by 2002:a63:a05d:: with SMTP id u29-v6mr1934163pgn.80.1528782448816; Mon, 11 Jun 2018 22:47:28 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id o77-v6sm379796pfj.0.2018.06.11.22.47.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 22:47:28 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Mauro Carvalho Chehab , Markus Elfring , Colin Ian King , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] media: tm6000: add error handling for dvb_register_adapter Date: Tue, 12 Jun 2018 13:47:20 +0800 Message-Id: <1528782443-43329-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528691962-31010-1-git-send-email-jiazhouyang09@gmail.com> References: <1528691962-31010-1-git-send-email-jiazhouyang09@gmail.com> 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..2e69486 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 adapter!\n"); + goto err; + } + dvb->adapter.priv = dev; if (dvb->frontend) { -- 2.7.4