Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
"One core change removing the 'w' access flag of attributes that don't
have a set routine (and therefore can't be written to) which should
have no practical impact. The big scsi_debug update is caused by
reformatting lots of arrays and the rest of the bug fixes in drivers
are trivial"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: ufs: core: Remove error print for devm_add_action_or_reset()
scsi: ufs: mediatek: Fix out-of-bounds access in MCQ IRQ mapping
scsi: lpfc: Remove redundant assignment to avoid memory leak
scsi: lpfc: Fix wrong function reference in a comment
scsi: ufs: core: Fix interrupt handling for MCQ Mode
scsi: scsi_debug: Make read-only arrays static const
scsi: core: sysfs: Correct sysfs attributes access rights

Changed files
+69 -43
drivers
-1
drivers/scsi/lpfc/lpfc_debugfs.c
··· 6280 6280 } 6281 6281 phba->nvmeio_trc_on = 1; 6282 6282 phba->nvmeio_trc_output_idx = 0; 6283 - phba->nvmeio_trc = NULL; 6284 6283 } else { 6285 6284 nvmeio_off: 6286 6285 phba->nvmeio_trc_size = 0;
+1 -1
drivers/scsi/lpfc/lpfc_vport.c
··· 666 666 * Take early refcount for outstanding I/O requests we schedule during 667 667 * delete processing for unreg_vpi. Always keep this before 668 668 * scsi_remove_host() as we can no longer obtain a reference through 669 - * scsi_host_get() after scsi_host_remove as shost is set to SHOST_DEL. 669 + * scsi_host_get() after scsi_remove_host as shost is set to SHOST_DEL. 670 670 */ 671 671 if (!scsi_host_get(shost)) 672 672 return VPORT_INVAL;
+57 -34
drivers/scsi/scsi_debug.c
··· 2674 2674 2675 2675 static int resp_err_recov_pg(unsigned char *p, int pcontrol, int target) 2676 2676 { /* Read-Write Error Recovery page for mode_sense */ 2677 - unsigned char err_recov_pg[] = {0x1, 0xa, 0xc0, 11, 240, 0, 0, 0, 2678 - 5, 0, 0xff, 0xff}; 2677 + static const unsigned char err_recov_pg[] = { 2678 + 0x1, 0xa, 0xc0, 11, 240, 0, 0, 0, 2679 + 5, 0, 0xff, 0xff 2680 + }; 2679 2681 2680 2682 memcpy(p, err_recov_pg, sizeof(err_recov_pg)); 2681 2683 if (1 == pcontrol) ··· 2687 2685 2688 2686 static int resp_disconnect_pg(unsigned char *p, int pcontrol, int target) 2689 2687 { /* Disconnect-Reconnect page for mode_sense */ 2690 - unsigned char disconnect_pg[] = {0x2, 0xe, 128, 128, 0, 10, 0, 0, 2691 - 0, 0, 0, 0, 0, 0, 0, 0}; 2688 + static const unsigned char disconnect_pg[] = { 2689 + 0x2, 0xe, 128, 128, 0, 10, 0, 0, 2690 + 0, 0, 0, 0, 0, 0, 0, 0 2691 + }; 2692 2692 2693 2693 memcpy(p, disconnect_pg, sizeof(disconnect_pg)); 2694 2694 if (1 == pcontrol) ··· 2700 2696 2701 2697 static int resp_format_pg(unsigned char *p, int pcontrol, int target) 2702 2698 { /* Format device page for mode_sense */ 2703 - unsigned char format_pg[] = {0x3, 0x16, 0, 0, 0, 0, 0, 0, 2704 - 0, 0, 0, 0, 0, 0, 0, 0, 2705 - 0, 0, 0, 0, 0x40, 0, 0, 0}; 2699 + static const unsigned char format_pg[] = { 2700 + 0x3, 0x16, 0, 0, 0, 0, 0, 0, 2701 + 0, 0, 0, 0, 0, 0, 0, 0, 2702 + 0, 0, 0, 0, 0x40, 0, 0, 0 2703 + }; 2706 2704 2707 2705 memcpy(p, format_pg, sizeof(format_pg)); 2708 2706 put_unaligned_be16(sdebug_sectors_per, p + 10); ··· 2722 2716 2723 2717 static int resp_caching_pg(unsigned char *p, int pcontrol, int target) 2724 2718 { /* Caching page for mode_sense */ 2725 - unsigned char ch_caching_pg[] = {/* 0x8, 18, */ 0x4, 0, 0, 0, 0, 0, 2726 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 2727 - unsigned char d_caching_pg[] = {0x8, 18, 0x14, 0, 0xff, 0xff, 0, 0, 2728 - 0xff, 0xff, 0xff, 0xff, 0x80, 0x14, 0, 0, 0, 0, 0, 0}; 2719 + static const unsigned char ch_caching_pg[] = { 2720 + /* 0x8, 18, */ 0x4, 0, 0, 0, 0, 0, 2721 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 2722 + }; 2723 + static const unsigned char d_caching_pg[] = { 2724 + 0x8, 18, 0x14, 0, 0xff, 0xff, 0, 0, 2725 + 0xff, 0xff, 0xff, 0xff, 0x80, 0x14, 0, 0, 0, 0, 0, 0 2726 + }; 2729 2727 2730 2728 if (SDEBUG_OPT_N_WCE & sdebug_opts) 2731 2729 caching_pg[2] &= ~0x4; /* set WCE=0 (default WCE=1) */ ··· 2748 2738 { /* Control mode page for mode_sense */ 2749 2739 unsigned char ch_ctrl_m_pg[] = {/* 0xa, 10, */ 0x6, 0, 0, 0, 0, 0, 2750 2740 0, 0, 0, 0}; 2751 - unsigned char d_ctrl_m_pg[] = {0xa, 10, 2, 0, 0, 0, 0, 0, 2752 - 0, 0, 0x2, 0x4b}; 2741 + static const unsigned char d_ctrl_m_pg[] = { 2742 + 0xa, 10, 2, 0, 0, 0, 0, 0, 2743 + 0, 0, 0x2, 0x4b 2744 + }; 2753 2745 2754 2746 if (sdebug_dsense) 2755 2747 ctrl_m_pg[2] |= 0x4; ··· 2806 2794 2807 2795 static int resp_iec_m_pg(unsigned char *p, int pcontrol, int target) 2808 2796 { /* Informational Exceptions control mode page for mode_sense */ 2809 - unsigned char ch_iec_m_pg[] = {/* 0x1c, 0xa, */ 0x4, 0xf, 0, 0, 0, 0, 2810 - 0, 0, 0x0, 0x0}; 2811 - unsigned char d_iec_m_pg[] = {0x1c, 0xa, 0x08, 0, 0, 0, 0, 0, 2812 - 0, 0, 0x0, 0x0}; 2797 + static const unsigned char ch_iec_m_pg[] = { 2798 + /* 0x1c, 0xa, */ 0x4, 0xf, 0, 0, 0, 0, 2799 + 0, 0, 0x0, 0x0 2800 + }; 2801 + static const unsigned char d_iec_m_pg[] = { 2802 + 0x1c, 0xa, 0x08, 0, 0, 0, 0, 0, 2803 + 0, 0, 0x0, 0x0 2804 + }; 2813 2805 2814 2806 memcpy(p, iec_m_pg, sizeof(iec_m_pg)); 2815 2807 if (1 == pcontrol) ··· 2825 2809 2826 2810 static int resp_sas_sf_m_pg(unsigned char *p, int pcontrol, int target) 2827 2811 { /* SAS SSP mode page - short format for mode_sense */ 2828 - unsigned char sas_sf_m_pg[] = {0x19, 0x6, 2829 - 0x6, 0x0, 0x7, 0xd0, 0x0, 0x0}; 2812 + static const unsigned char sas_sf_m_pg[] = { 2813 + 0x19, 0x6, 0x6, 0x0, 0x7, 0xd0, 0x0, 0x0 2814 + }; 2830 2815 2831 2816 memcpy(p, sas_sf_m_pg, sizeof(sas_sf_m_pg)); 2832 2817 if (1 == pcontrol) ··· 2871 2854 2872 2855 static int resp_sas_sha_m_spg(unsigned char *p, int pcontrol) 2873 2856 { /* SAS SSP shared protocol specific port mode subpage */ 2874 - unsigned char sas_sha_m_pg[] = {0x59, 0x2, 0, 0xc, 0, 0x6, 0x10, 0, 2875 - 0, 0, 0, 0, 0, 0, 0, 0, 2876 - }; 2857 + static const unsigned char sas_sha_m_pg[] = { 2858 + 0x59, 0x2, 0, 0xc, 0, 0x6, 0x10, 0, 2859 + 0, 0, 0, 0, 0, 0, 0, 0, 2860 + }; 2877 2861 2878 2862 memcpy(p, sas_sha_m_pg, sizeof(sas_sha_m_pg)); 2879 2863 if (1 == pcontrol) ··· 2941 2923 static int resp_compression_m_pg(unsigned char *p, int pcontrol, int target, 2942 2924 unsigned char dce) 2943 2925 { /* Compression page for mode_sense (tape) */ 2944 - unsigned char compression_pg[] = {0x0f, 14, 0x40, 0, 0, 0, 0, 0, 2945 - 0, 0, 0, 0, 00, 00}; 2926 + static const unsigned char compression_pg[] = { 2927 + 0x0f, 14, 0x40, 0, 0, 0, 0, 0, 2928 + 0, 0, 0, 0, 0, 0 2929 + }; 2946 2930 2947 2931 memcpy(p, compression_pg, sizeof(compression_pg)); 2948 2932 if (dce) ··· 3302 3282 3303 3283 static int resp_temp_l_pg(unsigned char *arr) 3304 3284 { 3305 - unsigned char temp_l_pg[] = {0x0, 0x0, 0x3, 0x2, 0x0, 38, 3306 - 0x0, 0x1, 0x3, 0x2, 0x0, 65, 3307 - }; 3285 + static const unsigned char temp_l_pg[] = { 3286 + 0x0, 0x0, 0x3, 0x2, 0x0, 38, 3287 + 0x0, 0x1, 0x3, 0x2, 0x0, 65, 3288 + }; 3308 3289 3309 3290 memcpy(arr, temp_l_pg, sizeof(temp_l_pg)); 3310 3291 return sizeof(temp_l_pg); ··· 3313 3292 3314 3293 static int resp_ie_l_pg(unsigned char *arr) 3315 3294 { 3316 - unsigned char ie_l_pg[] = {0x0, 0x0, 0x3, 0x3, 0x0, 0x0, 38, 3317 - }; 3295 + static const unsigned char ie_l_pg[] = { 3296 + 0x0, 0x0, 0x3, 0x3, 0x0, 0x0, 38, 3297 + }; 3318 3298 3319 3299 memcpy(arr, ie_l_pg, sizeof(ie_l_pg)); 3320 3300 if (iec_m_pg[2] & 0x4) { /* TEST bit set */ ··· 3327 3305 3328 3306 static int resp_env_rep_l_spg(unsigned char *arr) 3329 3307 { 3330 - unsigned char env_rep_l_spg[] = {0x0, 0x0, 0x23, 0x8, 3331 - 0x0, 40, 72, 0xff, 45, 18, 0, 0, 3332 - 0x1, 0x0, 0x23, 0x8, 3333 - 0x0, 55, 72, 35, 55, 45, 0, 0, 3334 - }; 3308 + static const unsigned char env_rep_l_spg[] = { 3309 + 0x0, 0x0, 0x23, 0x8, 3310 + 0x0, 40, 72, 0xff, 45, 18, 0, 0, 3311 + 0x1, 0x0, 0x23, 0x8, 3312 + 0x0, 55, 72, 35, 55, 45, 0, 0, 3313 + }; 3335 3314 3336 3315 memcpy(arr, env_rep_l_spg, sizeof(env_rep_l_spg)); 3337 3316 return sizeof(env_rep_l_spg);
+2 -2
drivers/scsi/scsi_sysfs.c
··· 265 265 return show_shost_mode(supported_mode, buf); 266 266 } 267 267 268 - static DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); 268 + static DEVICE_ATTR(supported_mode, S_IRUGO, show_shost_supported_mode, NULL); 269 269 270 270 static ssize_t 271 271 show_shost_active_mode(struct device *dev, ··· 279 279 return show_shost_mode(shost->active_mode, buf); 280 280 } 281 281 282 - static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); 282 + static DEVICE_ATTR(active_mode, S_IRUGO, show_shost_active_mode, NULL); 283 283 284 284 static int check_reset_type(const char *str) 285 285 {
+8 -4
drivers/ufs/core/ufshcd.c
··· 7138 7138 static irqreturn_t ufshcd_intr(int irq, void *__hba) 7139 7139 { 7140 7140 struct ufs_hba *hba = __hba; 7141 + u32 intr_status, enabled_intr_status; 7141 7142 7142 7143 /* Move interrupt handling to thread when MCQ & ESI are not enabled */ 7143 7144 if (!hba->mcq_enabled || !hba->mcq_esi_enabled) 7144 7145 return IRQ_WAKE_THREAD; 7145 7146 7147 + intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); 7148 + enabled_intr_status = intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE); 7149 + 7150 + ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS); 7151 + 7146 7152 /* Directly handle interrupts since MCQ ESI handlers does the hard job */ 7147 - return ufshcd_sl_intr(hba, ufshcd_readl(hba, REG_INTERRUPT_STATUS) & 7148 - ufshcd_readl(hba, REG_INTERRUPT_ENABLE)); 7153 + return ufshcd_sl_intr(hba, enabled_intr_status); 7149 7154 } 7150 7155 7151 7156 static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag) ··· 10521 10516 err = devm_add_action_or_reset(dev, ufshcd_devres_release, 10522 10517 host); 10523 10518 if (err) 10524 - return dev_err_probe(dev, err, 10525 - "failed to add ufshcd dealloc action\n"); 10519 + return err; 10526 10520 10527 10521 host->nr_maps = HCTX_TYPE_POLL + 1; 10528 10522 hba = shost_priv(host);
+1 -1
drivers/ufs/host/ufs-mediatek.c
··· 818 818 unsigned int q_index; 819 819 820 820 q_index = map->mq_map[cpu]; 821 - if (q_index > nr) { 821 + if (q_index >= nr) { 822 822 dev_err(hba->dev, "hwq index %d exceed %d\n", 823 823 q_index, nr); 824 824 return MTK_MCQ_INVALID_IRQ;