From patchwork Mon Dec 4 18:36:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10091245 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6B33F6035E for ; Mon, 4 Dec 2017 18:36:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6160E28D5A for ; Mon, 4 Dec 2017 18:36:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55F2928D5F; Mon, 4 Dec 2017 18:36:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8CC928D5A for ; Mon, 4 Dec 2017 18:36:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752129AbdLDSgg (ORCPT ); Mon, 4 Dec 2017 13:36:36 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:31911 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751980AbdLDSgf (ORCPT ); Mon, 4 Dec 2017 13:36:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1512412595; x=1543948595; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=frlvnTud0uEZMzX6Waqw3QJ1tfNVkfw8QSryubLJrQE=; b=n8i06tiGTtCtXsUVYZ4JxI9UL2G58HqDHzKvHffA3cN1OPPiAL16svX+ tTzTC884CyDrMKjdZJoQIa8hEOzvbJziu3DK+zMqMj4nALVtGHCx7Ol1H X4imI+sb1E64FCnlLznzLMhemcm2MJ6UIlvxjoUAfpOK1xu2Eh75dg1GV uXUuSEcqouIspDsVUS1dP54EtVf/AjihDk2Bfducj9E+9Yb3m6rCbz+Nw heSROWhVUM+X511PcdVIQvfjMsHr1BD60Obwvd2L1g0vbco8y5WTsTCFI McJV/MOIeIT9czmUosxkRWYGZXCMb/30bGGvMaRXkR45TANBuQ+MGg3UJ A==; X-IronPort-AV: E=Sophos;i="5.45,359,1508774400"; d="scan'208";a="166825172" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 05 Dec 2017 02:36:34 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 04 Dec 2017 10:33:13 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.166.51]) by uls-op-cesaip01.wdc.com with ESMTP; 04 Dec 2017 10:36:35 -0800 From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Christoph Hellwig , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH 1/3] scsi_get_device_flags_keyed(): Always return device flags Date: Mon, 4 Dec 2017 10:36:31 -0800 Message-Id: <20171204183633.32139-2-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171204183633.32139-1-bart.vanassche@wdc.com> References: <20171204183633.32139-1-bart.vanassche@wdc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since scsi_get_device_flags_keyed() callers do not check whether or not the returned value is an error code, change that function such that it returns a flags value even if the 'key' argument is invalid. Note: since commit 28a0bc4120d3 ("scsi: sd: Implement blacklist option for WRITE SAME w/ UNMAP") bit 31 is a valid device information flag so checking whether bit 31 is set in the return value is not sufficient to tell the difference between an error code and a flags value. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/scsi_devinfo.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 78d4aa8df675..2fed250e87bf 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c @@ -599,17 +599,12 @@ blist_flags_t scsi_get_device_flags_keyed(struct scsi_device *sdev, int key) { struct scsi_dev_info_list *devinfo; - int err; devinfo = scsi_dev_info_list_find(vendor, model, key); if (!IS_ERR(devinfo)) return devinfo->flags; - err = PTR_ERR(devinfo); - if (err != -ENOENT) - return err; - - /* nothing found, return nothing */ + /* key or device not found: return nothing */ if (key != SCSI_DEVINFO_GLOBAL) return 0;