From patchwork Tue Aug 22 06:48:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 13360240 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD185EE4996 for ; Tue, 22 Aug 2023 06:48:39 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.588163.919636 (Exim 4.92) (envelope-from ) id 1qYLBg-0006aG-93; Tue, 22 Aug 2023 06:48:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 588163.919636; Tue, 22 Aug 2023 06:48:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qYLBg-0006a9-6T; Tue, 22 Aug 2023 06:48:24 +0000 Received: by outflank-mailman (input) for mailman id 588163; Tue, 22 Aug 2023 06:48:23 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qYLBf-0006a0-Ap for xen-devel@lists.xenproject.org; Tue, 22 Aug 2023 06:48:23 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e17cb829-40b7-11ee-9b0c-b553b5be7939; Tue, 22 Aug 2023 08:48:20 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AB61022C44; Tue, 22 Aug 2023 06:48:19 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 63BCB132B9; Tue, 22 Aug 2023 06:48:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gEfnFjNa5GT1RQAAMHmgww (envelope-from ); Tue, 22 Aug 2023 06:48:19 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e17cb829-40b7-11ee-9b0c-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1692686899; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=APnjFGwfih6UCAXoJMMRdQoOq8OBAmD6tC504XVu2hI=; b=bkwRhsaNBr7hSCKRdCiTWuVi4gmgk2wU/CZXn9i1WP5nUbWsubap59D0RKgZhAPMvqgAn+ tHlmT28NkT8ql+7GpI/XExWnlfBPR0yes3G9BRSAR3iAFuECjrtiKXPKvGq/8kqY+D5V0+ gIqBb+pKx1aeQ90DZ+EwK6IgpBXsV9k= From: Juergen Gross To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , "James E.J. Bottomley" , "Martin K. Petersen" , xen-devel@lists.xenproject.org, Dan Carpenter Subject: [PATCH] xen/scsifront: shost_priv() can never return NULL Date: Tue, 22 Aug 2023 08:48:17 +0200 Message-Id: <20230822064817.27257-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 There is no need to check whether shost_priv() returns a non-NULL value, as the pointer returned is just an offset to the passed in parameter. While at it replace an open coded shost_priv() instance. Reported-by: Dan Carpenter Signed-off-by: Juergen Gross --- drivers/scsi/xen-scsifront.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c index caae61aa2afe..9ec55ddc1204 100644 --- a/drivers/scsi/xen-scsifront.c +++ b/drivers/scsi/xen-scsifront.c @@ -743,7 +743,7 @@ static int scsifront_sdev_configure(struct scsi_device *sdev) if (info->host_active == STATE_ERROR) return -EIO; - if (info && current == info->curr) { + if (current == info->curr) { err = xenbus_printf(XBT_NIL, info->dev->nodename, info->dev_state_path, "%d", XenbusStateConnected); if (err) { @@ -761,7 +761,7 @@ static void scsifront_sdev_destroy(struct scsi_device *sdev) struct vscsifrnt_info *info = shost_priv(sdev->host); int err; - if (info && current == info->curr) { + if (current == info->curr) { err = xenbus_printf(XBT_NIL, info->dev->nodename, info->dev_state_path, "%d", XenbusStateClosed); if (err) @@ -903,7 +903,7 @@ static int scsifront_probe(struct xenbus_device *dev, xenbus_dev_fatal(dev, err, "fail to allocate scsi host"); return err; } - info = (struct vscsifrnt_info *)host->hostdata; + info = shost_priv(host); dev_set_drvdata(&dev->dev, info); info->dev = dev;