From patchwork Sun Jul 9 05:04:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 700978 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8378CEB64DC for ; Sun, 9 Jul 2023 05:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbjGIFEU (ORCPT ); Sun, 9 Jul 2023 01:04:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229828AbjGIFET (ORCPT ); Sun, 9 Jul 2023 01:04:19 -0400 Received: from out203-205-251-84.mail.qq.com (unknown [203.205.251.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FA9FFE; Sat, 8 Jul 2023 22:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1688879053; bh=2w9Ob3VPQ9Os5ZjD5baI+SINI6IqLXe9l6ekBIWOX74=; h=From:To:Cc:Subject:Date; b=q6vYX9LBGG98Ceo8dv2JLWHjRaa5igrg/ZYqY50QV6qhc765u2LUZDSXz3npaseAj 2Wuu9D0VaeLkwj2xl9aIjrVjH5GghXU5vlI7FEG1osaWavQrcHHeXgpxyJoDIRj7gu tBRzeyen2Um8tGJlYI94y6kWQ8Q75ShOiRt+t9LQ= Received: from KernelDevBox.byted.org ([180.184.84.173]) by newxmesmtplogicsvrszc2-1.qq.com (NewEsmtp) with SMTP id 10B11A2A; Sun, 09 Jul 2023 13:04:11 +0800 X-QQ-mid: xmsmtpt1688879051t9yovwwoe Message-ID: X-QQ-XMAILINFO: N2/jAoEINg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zhang Shurong To: mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH] media: dvb-usb: opera1: fix uninit-value in dvb_usb_adapter_dvb_init Date: Sun, 9 Jul 2023 13:04:09 +0800 X-OQ-MSGID: <20230709050409.717720-1-zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org If opera1_xilinx_rw fails, the mac address is not initialized. And opera1_read_mac_address does not handle this failure, which leads to the uninit-value in dvb_usb_adapter_dvb_init. Fix this by handling the failure of opera1_xilinx_rw. Signed-off-by: Zhang Shurong --- drivers/media/usb/dvb-usb/opera1.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb/opera1.c b/drivers/media/usb/dvb-usb/opera1.c index 98b2177667d2..d269f8bb2dee 100644 --- a/drivers/media/usb/dvb-usb/opera1.c +++ b/drivers/media/usb/dvb-usb/opera1.c @@ -439,9 +439,14 @@ MODULE_DEVICE_TABLE(usb, opera1_table); static int opera1_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) { + int ret; u8 command[] = { READ_MAC_ADDR }; - opera1_xilinx_rw(d->udev, 0xb1, 0xa0, command, 1, OPERA_WRITE_MSG); - opera1_xilinx_rw(d->udev, 0xb1, 0xa1, mac, 6, OPERA_READ_MSG); + ret = opera1_xilinx_rw(d->udev, 0xb1, 0xa0, command, 1, OPERA_WRITE_MSG); + if (ret) + return ret; + ret = opera1_xilinx_rw(d->udev, 0xb1, 0xa1, mac, 6, OPERA_READ_MSG); + if (ret) + return ret; return 0; } static int opera1_xilinx_load_firmware(struct usb_device *dev,