Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4817426imm; Mon, 11 Jun 2018 20:19:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK1/9sTXeDCcesWy0uoKBLsNYAHXy0BSZVlnvcQoDNplAW3TuIq4yT0rmfjWXkXLJt3hBKO X-Received: by 2002:a17:902:294a:: with SMTP id g68-v6mr2079501plb.58.1528773571154; Mon, 11 Jun 2018 20:19:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528773571; cv=none; d=google.com; s=arc-20160816; b=pVGidGYk/Tv/Z2YU0Z/tMQTzdXjw6dp81H/OTPbFE+anSLOntLwY99tn71rwIkiYkH 0PaL7K+eVgXaNXBOjILI1+FjtDjS0z7GMAOU4sgDCj4wzfRwznyEP0dIEipoGA3tQhB2 A0T6782rkvL7Uly5FuEbOZmzpoX4G/e+UyVhZQmEXpfufxjHDHy/VggJMfSXVVRQ7ta0 lDDSg7eUY8iQKcLULGqqnSGR0Ljqw2Re+k2rdxn58/2XQSPlZ3Pti5glxFoIX8S0UPQe goDJUtILf4fi5vi9ePR+a3fsIF88Mn1vByyWTzT/4TpsKdY1uQTkA3/eJYYAhTkd9sbP /ioA== 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=vkv0zEh+5vEfXB38QeN4K+VfY7Mvie1rV49quym6l9M=; b=fJGJ4Am5yOM83HM9oHlAxc5RvcHjH3YQKuA/EWVNyGoSKJyWyBDBJmKuEOVaCCFpXV 8/9uEzaDjgP2iVE8o6ns3x+fZwVp8DYq5x8zcAjNixhUsAEF+Z80w/oaTUVTtG4iseoA 8Teto5Nmz7Bvd0MtprhgzD/ecPA321WAeqMk+H+EbsasYLDSIbRVEv4I+KPjQlPdn7l4 j2tXurpb8XEE5oUyPzh3chnibcivb5pp3AZ6NY8ki8lZFDrJRYIOzaUd96z1oYFT4wIC 9KYR6tzhbqYXdHMYsYhR2CVicsdBzVht6lLWCfgfqO/p9Vm4EiexQes121UstJmQbcv/ uwSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QfNckSnD; 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 a3-v6si50763601pgq.652.2018.06.11.20.19.16; Mon, 11 Jun 2018 20:19: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=QfNckSnD; 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 S1754148AbeFLDSx (ORCPT + 99 others); Mon, 11 Jun 2018 23:18:53 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:38366 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752839AbeFLDSv (ORCPT ); Mon, 11 Jun 2018 23:18:51 -0400 Received: by mail-pg0-f66.google.com with SMTP id c9-v6so10747576pgf.5 for ; Mon, 11 Jun 2018 20:18:51 -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=vkv0zEh+5vEfXB38QeN4K+VfY7Mvie1rV49quym6l9M=; b=QfNckSnDKA3qRKm96Jp11NJk9YbYc27Uj8h1tW94sN0zTzARKPfJV+wajCa/Q2qpm8 H/Q1RYMBCmINV6P6I9aqTHTwbNoEo9i51ewXWaZg2D3BozKMVYKfwru9NmUuG0S/4+Rz oue8h4ppjYGxlnECakr/vYV2j0roiM1WlWsl2mGxBPl5PvxuiIJL+wHrI7g3raL0bK0L 6sE8VagjY71uKdQWpmoHXeBR2a7oCe5E3h/r5B5SIHxmfmh41kIvqChzHuhTVS0qCiwp aBeLGs+BIR/gH2GMubwtZ9lt2nD0lwtIIXdqRo1jUQOtbORwcRZfuu6hrYlwe1LxVR7p s7eQ== 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=vkv0zEh+5vEfXB38QeN4K+VfY7Mvie1rV49quym6l9M=; b=Nm9g/wHeWjd9HIAtymBbLOqZVm4xyUSuJIh8RbYBIhCdK3yaNKoDVHFmNTt5fPioKL faNXUnXkNjMTKjvi+++bnr1FEwJpnM1MAssKeuee7EVdpUdzgbsTPXVBCV7mhZhMXkE5 ki/3Cn7+O/mzIDvUxN7osh9jwZC4AaiZfr34Ne2KvHtGTOBrvhKTfDyqjN4Z/ZUUrMGp o9C+KBmfazml3hBQjowCNRBfYypYHlobX0aOjwFO9hV5ZeT1X0ZfoRKFMnpbTeP0MQjV zUAhRdiVC0cHJxB1VPNvywRVwAWiIviaXdx9hIGqylj45HQAUT2PTPu6Y4fGF70kovYv uIZw== X-Gm-Message-State: APt69E1cHEfYEFDpZlDdyPU7HbMqfWT8LmRku7PTKFK0p4qb2KEI1kaf 2ZieVcO1BJnT4YDqghCZbnk= X-Received: by 2002:a63:980a:: with SMTP id q10-v6mr1592594pgd.50.1528773531376; Mon, 11 Jun 2018 20:18:51 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id z82-v6sm54973325pfk.30.2018.06.11.20.18.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 20:18:50 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Larry Finger , Florian Schilhabel , Greg Kroah-Hartman , Liam Ryan , Colin Ian King , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: rtl8712: add error handling for register_netdev Date: Tue, 12 Jun 2018 11:18:43 +0800 Message-Id: <1528773525-37564-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 register_netdev fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling register_netdev. Signed-off-by: Zhouyang Jia --- drivers/staging/rtl8712/hal_init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c index 2a3f074..2b47e75 100644 --- a/drivers/staging/rtl8712/hal_init.c +++ b/drivers/staging/rtl8712/hal_init.c @@ -40,6 +40,7 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context) { struct _adapter *padapter = context; + int rc; complete(&padapter->rtl8712_fw_ready); if (!firmware) { @@ -53,7 +54,12 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context) } padapter->fw = firmware; /* firmware available - start netdev */ - register_netdev(padapter->pnetdev); + rc = register_netdev(padapter->pnetdev); + if (rc) { + struct usb_device *udev = padapter->dvobjpriv.pusbdev; + + dev_err(&udev->dev, "r8712u: Unable to register netdev\n"); + } } static const char firmware_file[] = "rtlwifi/rtl8712u.bin"; -- 2.7.4